Forum Discussion
shishir_sontakk
Nimbostratus
Feb 01, 2019Strip URI word between first two "/"
Hello, I am looking to see how to strip a word between first two "/" in URI?
Example:
I would like to strip "abc" and store in some variable which can be used for sending traffic to differ...
Rico
Cirrus
Feb 01, 2019You can use getfield to return a specific part of the URI like this:
set var [getfield [HTTP::uri] "/" 2]
This will return abc in your case
Or if you want to strip out/modify specific parts if the URI, you can use the split command to return a list of elements like this:
set elements [split [HTTP::uri] "/"]
set e1 [lindex $elements 0]
set e2 [lindex $elements 1]
set e3 [lindex $elements 2]
set e4 [lindex $elements 3]
In your case e1 would be empty, e2 would be abc, e3 would be garbage, and e4 would be moregarbage
If you have any more questions, I am sure I can help
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