cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Regex to group Web Request

skung
Organizer

Need help to get regex to set up Web Request Measure - the URI looks like "/product-services/rest/v3/vehicle/quotes/040151560596905/bind"

The rule is to measure web request URI of any control number - /product-services/rest/v3/vehicle/quotes/{controlnumber}/bind

Sharyl

9 REPLIES 9

Radu
Dynatrace Pro
Dynatrace Pro

\/product-services\/rest\/v3\/vehicle\/quotes\/\d+\/bind


That will match your exact URI and where the {controlnumber} is it is looking for 1 or more digits. Feel free to replace with exact number of digits if all control numbers are same length.
Regards,
Radu



Best regards,
Radu

skung
Organizer

Radu,

Thank you. It works. Here is another question: can I create another web request measure for both URI patterns -

/product-services/rest/v3/vehicle/quotes/040151560596905"

/product-services/rest/v3/vehicle/quotes"

Or it has to be two separate measure?

Sharyl

Radu
Dynatrace Pro
Dynatrace Pro

With regex, you can achieve nearly anything. Try this:

\/product-services\/rest\/v3\/vehicle\/quotes(\/\d+)?

That should match both when the URI ends with 'quotes' and when it continues with /{controlnumber}. I guess it all depends on whether you want all of the results bundled under one measure or want it split in two.

Regards,

Radu



Best regards,
Radu

skung
Organizer

Thank you. That works.

skung
Organizer

Hi, Radu,

I have another instance - URI pattern sample:

https://mobile-sgroext-pd.abccompany.com/mobile/MobileApps/ARS/NRHG/rescues/15435366/status

the number is request# and it is unique. Measure I am going to set is to read the URL 1) it must have /mobile/MobileApps/ARS/NRHG/rescues/(request#)/status 2) not to report for every request# but aggregate to total as long as URL matches 1) mentioned

Sharyl

Appmon does something useful in this situation, and captures all capturing-groups in the pattern and prints them space-delimited. Try:

(\/mobile\/MobileApps\/ARS\/NRHG\/rescues\/)[0-9]*(\/status)

edit: escaped the slashes and validated it

skung
Organizer

Hi, Rick

I used this one but it returned no match found

(\/mobile\/MobileApps\/ARS\/NRHG\/rescues\/)[0-9]*(\/status)

Sharyl

Odd,
are you sure you do not have the fields backward? Also keep in mind
we're not matching against hostname, just the path and optionally the
query

skung
Organizer

Thank you. There was a typo in my test.

Sharyl