RegEx for overlapping matches - pattern works in regex101.com, but not within UiPath

Hi,
I have a RegEx pattern which works within reges101.com, but not properly within UiPath.

(?=((\d){4}))

Example:
Input: 123456
Output: [1234], [2345], [3456]

I am getting
,,

Can someone please help me with that?

Thank you in advance!

Hi @GrKa - May I ask you, what is your requirement? i.e from the input value what you are trying to extract?

Hi @prasath17,

The input is a string of numbers, e.g. “123456” and I would like to have all (overlapping) matches consisting of four numbers.

Does this clarify your questions? Please let me know if you need further information.

@GrKa - Got it…Here you go…

StrOutput = Regex.Matches(“123456”,“(?=((\d){4}))”)

For Each Loop and Output

Thanks for taking the time.

I have exactly the same and this is my result:

@GrKa - Your output is stored in the groups…If you watch the screenshot closely, outputs are listed under $1 and $2…and you are interested in $1 which is group $1…

So you have to give item.groups(1).tostring. For this , you have to change the For Each type to System.text.Regularexpression.match…

Thank you so much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.