Forum Discussion
Naman_65674
Oct 20, 2011Nimbostratus
Best Practice: Regex vs number of if/else
Hi, I previously had a rule that had: if { $login == 1 && ([string first "OP=help" [HTTP::header "location"]] == -1) && ([string first "OP=token_lo...
Naman_65674
Oct 21, 2011Nimbostratus
That actually might be a good idea spark, as i would be able to add the list quite easily.
So if i had a dataclass with:
class error_msgs {
"OP=help"
"OP=token_login"
"OP=error"
"ERR_CODE=0x13212077"
"ERR_CODE=0x132120c8"
"OP=acct_locked"
}
Would it be as simple as:
if { [matchclass $::error_msgs contains [HTTP::header "location"]] == 0 } {
...do something...
}
I got a bit worried reading the matchclass wiki doco, especially:
"And this example will will return the index of the first row containing any of contiguous characters in the string "green" (g, r, e, n, gr, re, ee, en, gre, ree, een, gree, reen, and green will all match):
[matchclass "green" contains $::data_group]"
I only want it to compare on the whole word.....
-- NJ
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