How to get the following output using Assign Activity and String manipulation

How to fetch the floowing output string using string manipulation? Kindly help

Input => 1025-MISD : Uenrkte KIFEDREWES CORP (333-22-1234)
Expected output string => 333-22-1234

Hi @Ruchi ,

Use the below expression:

System.Text.RegularExpressions.Regex.Match(inputString,"\((\d{3}-\d{2}-\d{4})\)").Groups(1).Value

Regards,

try this

System.text.RegularExpressions.Regex.Match("1025-MISD : Uenrkte KIFEDREWES CORP (333-22-1234)","(?<=\().*(?=\))").Value

Regards

Hello @Ruchi
Try this Regular Expression

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\().+(?=\))").Tostring.trim

Welcome @Ruchi to the UiPath Community :partying_face:

It’s great to see replies so fast on your 1st topic.

You can use Regex to achieve what you are asking.

Take a look at my Regex MegaPost to learn Regex

Cheers

Steve

Hi

Thank you for the solution, but I cant use regex, I have to use assign activity only

Hi @Ruchi ,

You can use the above mentioned expression in the assign activity, keep the string variable in the left side of the assign and the regex expression in the right side. The values will be stored in your string variable.

Regards,

It worked!

Thank you so much for the help!!
Also, could you please suggest a regex generator online, where I can enter mu statement as input and get the output from the generator directly, since I am new to regex

1 Like

@Ruchi ,

Hey @Ruchi

Use Regex101.com to help you learn Regex and for basic patterns.

Then use .NET Regex Tester - Regex Storm for more advanced Regex patterns in the future and 100% compatibility with UiPath.

Cheers

Steve

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