UIPath dynamic regex

I want to create a dynamic regex that would get the data between 02004946(8 digits) and 3 chracters which is for example CXS and RTX.

The regex should get HELLO1
#Smple data


06/30/20       B      QM      02004946        HELLO1          RTX                                   

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(text,"(?<=\d{8}\s*)\S+(?=\s*[A-Za-z]{3})").Value

Regards,

there is a compile error with the regex

Hi,

What error do you have? In my environment, it works well.

Regards,

06/30/20 B QM 02004946 HELLO1 ADASDA DASDAS RTX

based on this example the output is just HELLO1 the output should also include ADASDA DASDAS because its between

EXPECTED OUTPUT “HELLO1 ADASDA DASDAS”

How do we include the whole string Sir ? for example in the data below

06/30/20 B QM 02004946 HELLO1 ADASDA DASDAS RTX

the output should be “HELLO1 ADASDA DASDAS”

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(text,"(?<=\d{8}\s*).*(?=\s+\w{3}(\W|$))").Value.Trim

Regards,

1 Like

Thank you Sir.

1 Like

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