Forum Discussion
Mike_S_64601
Nimbostratus
Apr 11, 2007Problem using regexp - syntax error on [
First time attempting to use a regexp in an irule; running into a syntax error in this script:
when HTTP_REQUEST {
if { [HTTP::uri] matches_regex "^\/[a-zA-Z][a-zA-Z]\/" } {
...
hoolio
Cirrostratus
Apr 12, 2007Else, I think you could use the wildcards (? or [chars]) available in TCL's string match command for a lighter weight comparison:
string match pattern string
See if pattern matches string; return 1 if it does, 0 if it doesn't. Matching is done in a fashion similar to that used by the C-shell. For the two strings to match, their contents must be identical except that the following special sequences may appear in pattern:
*
Matches any sequence of characters in string, including a null string.
?
Matches any single character in string.
[chars]
Matches any character in the set given by chars. If a sequence of the form x-y appears in chars, then any character between x and y, inclusive, will match.
\x
Matches the single character x. This provides a way of avoiding the special interpretation of the characters *?[]\ in pattern.
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