How to get Particular value from a string using Regex Expression?

Hi All,

I want to get the values of ClientID, ClientName, ClientCountry using Regex.

Client ID: MH61370
Client Name: Carly Sitzman
Client Country: Italy

Using GetText Activity, I have stored the data in a variable named “Info”

Inside Assign activity I’m using System.Text.RegularExpressions.Regex.Match(Info, “”).Value

I want to know what should I give inside double quotations, so that it extracts the values of Clientid, name and country.

Also if there is any other alternative to fetch the values, please help me with that.

Thanks in Advance :slight_smile:

Hi @Vaishnav_Tej ,

You would require to use 3 Expressions to extract the 3 values or we would need to have Capturing Groups :
Client ID :

System.Text.RegularExpressions.Regex.Match(Info, "(?<=Client ID:).*").Value.Trim

Client Name :

System.Text.RegularExpressions.Regex.Match(Info, "(?<=Client Name:).*").Value.Trim

Client Country :

System.Text.RegularExpressions.Regex.Match(Info, "(?<=Client Country:).*").Value.Trim
(.*?)(?=\:)(.*)

A generic one where WE refer to groups

2 Likes

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