can we capture specific URI value from uri path

Hi set captured_value [getfield [HTTP::uri] “/” 4] In above syntax instead of “/” 4, can we capture specific URI value from path like

https://www.abc.com/114/valueA=100/valueB=200

Can we catch value A and Value B

As long as those are path and not query values and always in the same location as your example the following will get the data values from within the path:

set valueA [getfield [getfield [HTTP::path] "/" 3] "=" 2]
set valueB [getfield [getfield [HTTP::path] "/" 4] "=" 2]

Hi,

2 solutions for you:

First solution:

set uri [HTTP::uri]
regexp {^.*valueA=([^\/]+)\/valueB=(.*)$} $uri -> valuea valueb

Second solution:

set uri [HTTP::uri]

set valuea [findstr $uri /valueA= 8 /]
set valueb [findstr $uri /valueB= 8 end]

Hope it will help you. keep me in touch.

regards,

Hi,

you can use scan command, faster than regexp…

scan [HTTP::uri] {/%[^/]/valueA=%[^/]/valueB=%[^/]} garbage valueA valueB