Forum Discussion
Idealf5
Nimbostratus
Jul 14, 2015String after the last slash starts_with
Hi,
I need help with an IF-Statement that checks the first two characters after the last slash in the Uri. If it starts with a 'k' followed by a number (k[0-9]), then do something. If the second character after the 'k' is not a number then do nothing.
Examples: www.xyz.com/bla/blub/k20ab154 - Do something www.xyz.com/bla/blub/kab20154 - Do nothing
Thank you in advance
Sven
1 Reply
- Kevin_Stewart
Employee
Here's one option that avoids regular expressions:
when HTTP_REQUEST { if { [string index [HTTP::uri] [expr [string last "/" [HTTP::uri]] +1]] eq "k" } { if { [string is integer [string index [HTTP::uri] [expr [string last "/" [HTTP::uri]] +2]]] } { second character after "k" is a number - do something } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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