Forum Discussion
lstewart_53611
Nimbostratus
Apr 29, 2010regex error - help?
I'm getting an error when trying to use the matches_regex operator. I think I might be using regexes that would work in perl but not in TCL. Can anyone see what's wrong with this? This is at the end of an iRule which works fine without this final elseif, and my brackets are actually balanced in the full rule:
elseif {[HTTP::host] == "hostwearelookingat.com" } {
if { [HTTP::uri] contains "/1/Kingdoms/users/"} {
set urivar
if { ! ( $urivar matches_regex ^.*?
\/1\/Kingdoms\/users/\[a-zA-Z0-9]) } {
pool kingdoms-reserved
}
else {
pool prod-platform
}
}
When I try this, I get the error:
line 38: [parse error: PARSE syntax 989 {syntax error in expression " ! ( $urivar matches_regex .*?\/1\/Kingdoms\/users/\[a-zA-Z0...": character not legal in expressions}] [{ ! ( $urivar matches_regex .*?\/1\/Kingdoms\/users/\[a-zA-Z0-9]) }]
The purpose of the rule is to match a uri of /1/Kingdoms/users/(any alphanumeric) and NOT match anything else. If someone simply has another suggestion of how to do that more simply, I'll take that, too. But I'm not sure what the issue is with my expression above. Thanks in advance.
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