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:
...
JRahm
Jun 22, 2011Admin
I'm not seeing the issue:
when RULE_INIT {
foreach x [list "1234" "asdf" "wqer!" "asfd/"] {
log local0. "Val: $x"
set res [regexp {^(?:[a-z0-9/+=]+)$} $x]
log local0. "Res: $res"
}
}
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Val: 1234
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Res: 1
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Val: asdf
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Res: 1
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Val: wqer!
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Res: 0
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Val: asfd/
Jun 21 22:57:12 local/tmm info tmm[5091]: Rule regexp_test : Res: 1
Perhaps the variable in the regexp should be $decoded_val?
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