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

Web Request Naming - Placeholder using regex

phalgun
Newcomer

Hi

 

I am trying to name web requests using Placeholder. I have two web requests variations that must be named in the same format. How do I achieve this? I tried the regex way but I am not able to make it possessive as lookbacks and lookaheads are not allowed in DT. OR is there a non-regex solution? 

 

Original Web Requests

1. URL Path is /folder1/ws?serviceName=aBcD&methodName=xYz

2. URL Path is /folder1/ws?methodName=xYz&serviceName=aBcD

 

I need both of them to be renamed as 'Web Service - xYz'.

 

My solution was this:

Condition - URL Query contains 'methodName='

Placeholder - variable called MName, using URL Query, Regex extraction, regex string is methodName=([a-zA-Z]+). unfortunately this is greedy, so DT does not allow this. I need to 'match' the methodName= string, but it should not be in the result. 

 

I cant use the before/after/between delimiter here since the position of the methodName changes. 

 

5 REPLIES 5

ChadTurner
DynaMight Legend
DynaMight Legend

What if you add in the * for a value of methodName=([a-zA-Z]*+)

ChadTurner_0-1625661399996.png

 

-Chad

phalgun
Newcomer

Nice! that works! I was under the impression that both . and * are greedy and hence not allowed by DT. glad that * works. 

@phalgun I ran into the same issue with greedy quantifiers as well and kept looking and looking for a solution around the "+" I was extremely happy when I found that we could add the "*" to the + in order to negate the greedy classification :dancing_blob::party_blob::party_cat:

-Chad

Thanks Chad! That worked for me too :dancing_penguin:.

r_weber
DynaMight Champion
DynaMight Champion

You might want to try lookaround matches like this:

(?<=methodName=)[aA-zZ]*(?=\&)
Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

Featured Posts