Kyleb91
(Kyle Brown)
January 6, 2020, 3:09pm
1
Hi Guys,
I’ve got a Variable of text, example of what it contains is PP Username - X
I’m using the Match activity and want to get the ‘X’, what the username is and turn to String.
In the Match Pattern I have “(PP Username - )(\d)+”
Is this correct? It doesn’t seem to be working, as later I want to use this variable in a query execution, but it’s not outputting the username.
Any Thoughts?
J0ska
January 6, 2020, 3:35pm
2
Hi @Kyleb91 ,
1/ You could use e.g. https://regex101.com/ for regex testting
2/ “\d” matches digit characters, so it will not match “X”, use “\D” to match “X”
3/ You could use following expression in assign to get “X”
regex.Match("PP Username - X", "(PP Username - )(\D)+").Groups(2).Value
Cheers
1 Like
Kyleb91
(Kyle Brown)
January 6, 2020, 4:39pm
3
Hi Mate, thanks a lot;
So, should the first “PP Username - X” Be my Variable body of text? I have X here to signify a username which could be any length…
Kyleb91
(Kyle Brown)
January 6, 2020, 4:48pm
4
Also - this Username may likely contain digits also…
@Kyleb91
Try this:
(?<=PP Username - )\w *