Regex pattern and groups

hello everyone,

i have a problem with regex in uipath.
From regexr regular expression works with the following pattern:

(w{1}{d{1}{w{1})

basically i have to, within an email, recognize all existing patterns traceable to:

a1a, b3d, etc.

When I try to test it on uipath in the regex builder it finds me results unrelated to the expression, instead when I try to print the groups found, with the following expression:

regexMatch(0).Groups(1).Value

it returns empty to me.

My goal is to pull out all the a1a patterns and insert them inside a string array, or a datatable.

Thanks in advance

Hi @andreus91 ,

Could you change the expression to the below and Check :

(\w{1}\d{1}\w{1})

Use Matches Activity to get all occurrence of same pattern regex.
And than use RegMatche(0),RegMatche(1) to print all the elements of Regex match.

Where RegMatche is your output variable of Matches Activity in Uipath

kindly note: \w is matching letters and also digits
grafik

the a1a or the LetterDigitLetter Pattern?

in general we can do

System.Text.RegularExpressions.Regex.Matches(strInput,"\w\d\w").Cast(Of Match).Select(Function (m) m.Value).toArray