Forum Discussion
Richard_Jones
Jun 22, 2011Nimbostratus
Different results from TCL regexp and iRules regexp
I am working on an iRule that will validate the value of a parameter only contains a-z, 0-9, and / + =. I have created a regexp pattern that works in TCL, but not in an iRule:
TCL:
...
hoolio
Jun 23, 2011Cirrostratus
Now that you've figured out the regex option you could try using scan as well. scan is typically more efficient than a regex.
if {[scan $str {%[a-z0-9/+=]} match] and $match eq $str}{
log local0. "matched $str"
} else {
log local0. "no match for $str"
}
foreach str [list "1234" "asdf" "wqer!" "asfd/"] {
if {[scan $str {%[a-z0-9/+=]} match] and $match eq $str}{
log local0. "matched $str"
} else {
log local0. "no match for $str"
}
}
matched 1234
matched asdf
no match for wqer!
matched asfd/
Aaron
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