Forum Discussion
jay_41157
Nimbostratus
Sep 05, 2008wildcard in data group.
Hi ,
I am trying to use \apple\* --> * being wildcard... but i do not have the correct fromat.. in the data group. is there an escape squence ?
thanks
- hoolio
Cirrostratus
If you're using a string datagroup, you don't need to escape the *. You can use apple* unquoted and unescaped. If you're evaluating the class with findclass (Click here), you don't need to use a wildcard though. - jay_41157
Nimbostratus
I am using string data group, but I have matchclass instead of findclass, and when I use apple* --> it does not use the apple"*" as the wildcard. - hoolio
Cirrostratus
Does matchclass work with a * in the datagroup? I'm guessing not.when RULE_INIT { Create a test class (actually a list in this case) set ::test_class [list abcd abcde abcdef* abcdefg*] foreach element $::test_class { log local0. "Current \$element: $element" if {[string match -nocase $element "ABCDEFG"]}{ log local0. "Matched \$element: $element. Exiting loop." break } } }
- jay_41157
Nimbostratus
Thanks, I just read the wiki on matchclass that indicates what you said about * in datagroup not wokring with match class, so I am guess a more cleaner approach might be to use findclass as you initially mentioned in the irule: - jay_41157
Nimbostratus
I think this might be more accurate for syntax.. - hoolio
Cirrostratus
Catch is used to trap runtime errors. The only benefit for using catch with findclass is handling the TCL error if the class isn't defined.return 0 is false. Save the result of running the command 'return 0' to the variable named result if {[catch {return 0} result]}{ log local0. "catch was true, because return resulted in return code 0. Result: $result" } else { log local0. "catch was false, because return resulted in non-zero return code. Result: $result" } if {[catch {set ::test 1} result] }{ log local0. "catch was true, because the set command returned with an error. Result: $result" } else { log local0. "catch was false, because the set command returned without error. Result: $result" } if {[catch {set ::test $doesnt_exist} result] }{ log local0. "catch was true, because the set command returned with an error. Result: $result" } else { log local0. "catch was false, because the set command returned without error. Result: $result" }
test_class: /aaaaa /bbbbb /ccccc /ddddd /aaaaa/test
when RULE_INIT { set ::uri "/aaaaa/t" log local0. "Test URI: $::uri; \$::test_class: $::test_class ([llength $::test_class])" log local0. "\[findclass \$::test_class \$::uri\]: [findclass $::test_class $::uri]" log local0. "\[findclass \$::uri \$::test_class\]: [findclass $::uri $::test_class]" }
set test_uri "/ABCDEFG" log local0. "\$test_uri: $test_uri" Create a test class (actually a list in this case) set ::test_class [list /abcd /abcde /abcdef* /abcdefg*] foreach element $::test_class { log local0. "Current \$element: $element" if {[string match -nocase $element $test_uri]}{ log local0. "Matched \$element: $element. Exiting loop." break } }
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