Need Regex for Below String Value

Hi Team,

My string value is
String =Order not Confirmed: 6 DAS C40\r\nETA MARCH 20, 12:26PM\r\n\ fr\r\n— ORDER —\r\nRECEIVED\r\nEL rT TT Tea\r\ni 7 7 Coventry\r\n2 J Farlington 3\r\nEy 3 Y,\r\nNn \\r\nBostwick i: AN\r\ni 3,\r\nso N © iy\r\n7 | 4\r\n. ) I, 5,\r\n@ocgo | N I\r\nOnden #\r\n25504618965827585\r\n2.81 MILES |\r\n— NOLO); oo\r\nSC Nero\r\n@idoER RECEIVED)\r\nHOME REWARDS & MENU REORDER ACCOUNT\r\nJ oO O",

in these I need “25504618965827585” these value change dynamically
please anyone help me on the Regex on these String

Thank you

Hi @Mada_Sai_Krishna

Check the below regular expression,

(?<=#.r.*)\d+(?=.r.)

Store the input data in a variable called Input_Str.

- Assign -> Output = System.Text.RegularExpressions.Regex.Match(Input_Str.toString, "(?<=#.r.*)\d+(?=.r.)").Value

Hope it helps!!

Hi,

How about the following?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Onden #(\\r\\n|\s+))\d+").Value

Sample
Sample20240321-7 (2).zip (2.7 KB)

Regards,

Hi @mkankatala,
it’s not working.

Those regex work for me.

Could you share your workflow how it looks… @Mada_Sai_Krishna

please find the attached Xaml for your reference

Sequence.xaml (9.7 KB)

I need value in C# project

Hi @Mada_Sai_Krishna

If the Number length is fixed then you can go with below regex

\d{17}

if its not fixed then kindly go with below regex

(?<=\\r\\n)\d+(?=\\r\\n)

Hope it helps you out!

Could you try the below expression in your workflow… @Mada_Sai_Krishna

System.Text.RegularExpressions.Regex.Match(Rawtext.ToString(), @"(?<=#.r.*)\d+(?=.r)").Value

Hope it helps!!

HI,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(Rawtext,@"(?<=Onden #\s+)\d+").Value

Sample
Sample20240321-8CS.zip (6.0 KB)

Regards,

1 Like

it’s worked
Thank you

it’s also worked.

Thankyou.

1 Like

It’s my pleasure… @Mada_Sai_Krishna

Happy Automation!!

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