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,
Apr 28, 2006
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"
}
}Keep in mind that the matchclass returns a index based at 1 while the lindex command expects a 0 based index. So, you'll have to throw in a [expr $found -1] to decrement to account for this.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
