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
Normally you could use a capturing group defined by the expression in the parentheses to capture the matched characters. Here's an example:
regexp -inline {test([0-9]} "test321654654" original match
$original would be set to the original string of test321654654 and $match would be set to 321654654. See the TCL wiki page for regexp for details: http://www.tcl.tk/man/tcl8.4/TclCmd/regexp.htm
In your example, matches_regex doesn't support saving the matches. And it's much more efficient to use a string function to do the HTTP path checking anyhow.
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