Forum Discussion
Robert_47833
Apr 19, 2011Altostratus
question about :matches_regex
Hi,met trouble in matches_regex now
difference in expressions below
set uri [HTTP::path]
{$uri matches_regex "^/(cjj)"} { pool cjj01-BRO }
{$uri matches_regex...
hooleylist
Apr 19, 2011Cirrostratus
Hi,
I think both of those regexes would have the same exact matching. The parentheses would capture a match into a backreference which wouldn't be usable. If you wanted to match a literal ( or ), I think you'd need to escape them with backslashes.
Regardless, if you're just trying to check if the URI starts wtih /cjj or /(cjj), you could use a string pattern instead. This would be significantly more efficient than a regex.
switch -glob [HTTP::path] {
"/(cjj)*" { pool cjj01-BRO }
"/cjj*" { pool cjj01-WSE }
}
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