cancel
Showing results for 
Search instead for 
Did you mean: 

Capture value between slashes in uri

Jonathan_124522
Nimbostratus
Nimbostratus

I need an irule to capture the characters between slashes in a uri. For example, in the uri www.example.com/test1/test2/test3/ i want to set a variable value to what ever is between the second and third slashes which in this case would be test2.

 

1 REPLY 1

arpydays
Nimbostratus
Nimbostratus

Hi, try this

 

cheers

 

when HTTP_REQUEST { set a [getfield [HTTP::path] "/" 3] log local0. "value = $a" } $curl http://10.12.12.145/test1/test2/test3/ config info tmm1[17994]: Rule /Common/getfield : value = test2