Forum Discussion
Sep 12, 2013
strip-out string up to 2nd match char
f5 BIG-IP 11.4.0 LTM VE
iRule question
I need to strip-out the portion of a string up to ( but not including ) the 2nd occurrence of a character.
EXAMPLE : [HTTP:path] = /images/V00/icons/myicon.ico
What string manipulation would return "/images" ?
Thanks.
2 Replies
- Kevin_Stewart
Employee
All of these will work:
set string "/images/V00/icons/myicon.ico" log local0. "/[lindex [split $string /] 1]" log local0. "/[findstr $string / 1 /]" log local0. [string range $string 0 [expr [string first "/" $string 1] -1]] - What_Lies_Bene1
Cirrostratus
I've not time to look too closely but this command should do the trick: https://devcentral.f5.com/wiki/iRules.URI__path.ashx
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