Forum Discussion
Brian_69413
Sep 20, 2012Nimbostratus
regex issues
I have the following iRule switch statement:
[CODE]
switch -regexp [string tolower [HTTP::uri]] {
"/first/url/files/[1-9][\d]{0,6}" {
log local0. "You passed URL inspection!"
}
default {
reject
}
}
[/CODE]
I believe this should match the following URI: "/first/url/files/1000000"
However, it is also matching a URI like this: "/first/url/files/1000000000000000000000000000000000000"
Any ideas on this one?
- Kevin_StewartEmployeeI believe the problem is that you're not specifically evaluating to the end of the string. You need to use the "$" character at the end to indicate "to end of string".
when HTTP_REQUEST { switch -regexp [string tolower [HTTP::uri]] { "/first/url/files/[0-9]{0,7}$" { log local0. "You passed URL inspection!" } default { reject log local0. "rejected" } }
- Brian_69413NimbostratusThanks!
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