Forum Discussion
Bret_McGinnis_1
Nimbostratus
Apr 28, 2006matchclass
Hi,
Is there a way to tell which entry in the Data Group was matched by the matchclass function.
Regards,
- Colin_Walker_12Historic F5 AccountThe matchclass function should return the value of the record selected from the class by default. If you then log or otherwise display this value, you should see what's selected with each iterration of the command.
- Bret_McGinnis_1
Nimbostratus
Hi, - Data groups can be treated by TCL lists. To extract a item from a TCL list by index, you can use the lindex command.
when HTTP_REQUEST { set idx [matchclass [HTTP::uri] contains $::color] if { -1 != $idx } { set val [lindex $::color [expr $idx - 1]] log local0. "Found match index = $idx; value = $val" } else { log local0. "Didn't find a match" } }
- Bret_McGinnis_1
Nimbostratus
Hi, - That most likely was a bug that was fixed in one of your hotfixes. I'm not aware of that issue but there are a few things you could try. I'd try to break apart your rule into smaller elements and see if that makes a difference.
set m_i [matchclass [HTTP::uri] contains $::t_i] if { $m_i > 0 } { set new_index [expr $m_i - 1] set r_i [lindex $::t_i $new_index] }
- unRuleY_95363Historic F5 AccountAccessing a class/datagroup as a Tcl list was definitely broken (with your observed behavior) in 9.1.1 and requires a hotfix.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects