Match Activity - Getting Text after Pattern

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?

Hi @Kyleb91,
1/ You could use e.g. 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


1 Like

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…

Also - this Username may likely contain digits also…

Try this:
(?<=PP Username - )\w*