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

Regex Assistance

ChadTurner
DynaMight Legend
DynaMight Legend

Calling all regex Gurus! 

I'm trying to target the RxVisitor Value as a request attribute, what would be the best way to capture this? my current string 'rxVisitor=([^\-]*+)' captures data even after the ';' where the targeted value ends. 

 

ChadTurner_0-1699446088771.png

 

Many thanks in advance 🙂 

-Chad
5 REPLIES 5

victor_balbuena
Dynatrace Mentor
Dynatrace Mentor

It should be enough to add the semi-colon in that list of characters that shouldn't be matched:

rxVisitor=([^\-;]*+)

 

victor_balbuena_0-1699448952108.png

 

dannemca
DynaMight Guru
DynaMight Guru

Hi @ChadTurner , did you tried like this?
[^(;)]*+

Screenshot 2023-11-08 102705.png

 

 

Site Reliability Engineer @ Kyndryl

ChadTurner
DynaMight Legend
DynaMight Legend

Thanks for your replies 🙂 I did put in a 'between filter' from the start of the string to the end of the string but I also want to take into account of the duplicate values. Trying to formulate as to what that would look like as well from a cookie perspective. 

-Chad

ChadTurner
DynaMight Legend
DynaMight Legend

Hey Regex Gurus, 

I need some more assistance. so that RxVisitor can occur twice in the cookie payload, but I need to be able to target if 1 or 2 are present. So I was wondering, Could you assist me in building a Regex that looks for the RxVisitor as you did but for the first grouping, then another one that will look at the second grouping. 

Reason being is that we ran into a roadblock with the counting of cookies etc and it cant actually count the targeted segments in the cookie. 

So an example cookie payload would look like this: 

p_Verizonwt=1; DMFDQ_1jfosdjd768%40gov.Org=1; s_cc=true; sscook=11; rxVisitor=1111; UserIDValue=haksfuoth57639829fjasfdk37895o3k3rsdf; UserName=Santa.Clause; ; rxVisitor=2222; HIHTOKEN=abcdefg; GG20=1;

I'm interested in grating two RAs - the first RA will target and extract the cookie value of rxVisitor group 1. Which should result in a RA Key:Value pair of:
rxVisitor Group 1 = 1111

And then make another RA that looks at the same rxVisitor segment and extracts the data out but on a group 2 qualifier. Which should result in a RA Key:Value pair of:

rxVisitor Group 2 = 2222

 

Granted if there is no second qualifier on that cookie payload that is fine, I would then expect that the RA would not qualify. The biggest thing is that we create an RA when a second grouping of a cookie is found.

ChadTurner_0-1699969070055.png

 

Lastly the reason why we need to create two RAs is because the RA will only allow one capture group. 

-Chad

ChadTurner
DynaMight Legend
DynaMight Legend

I got the Groupings built 🙂 

rxVisitor=(?=1)[^\-;]*+

Basically change the ?=1 to the number of the groups you want to target. 1 gives you the first qualifier, 2 is the second and so on. 

So now I have two RAs, one looking at the first qualifier, then the second. So I expect the second to always be empty, if it has a value then we have issues. this can also be added at the session level for the apps. 

ChadTurner_0-1699981722229.png

 

-Chad

Featured Posts