Finding Sting In the Body Using REGEX

Hi all,

Could any one help me in identifying the Specific Value from the Mail body. I want to extract the specific values from the Body Using REGEX and the values are

  1. “RC3.REF”
  2. “RC3.RAIL_NO”
  3. “Origin Location”

From the Body which Looks like as shown below.

This is mail regarding the Regex PAttern Identification. please identify the String “RC3.REF” and the Number is “RC3.RAIL_NO” for the Defined Location “Origin Location”

Thanks

Hi @srinusoft37

Can you share the Mail Body Content here

Regards
Gokul

Thanks for your reply, The content look like as below

This is mail regarding the Regex PAttern Identification. please identify the String “RC3.REF” and the Number is “RC3.RAIL_NO” for the Defined Location “Origin Location”

In this I need to extract the values which are in quotations

Thanks

Here this Three string are static are it will change every time @srinusoft37

Hi
This 3 are static, No change in the Body

Thanks

HI @srinusoft37

Then its very simple how about this expression

System.Text.RegularExpressions.Regex.Match(YourString,"RC3.REF|RC3.RAIL_NO|Origin Location").Tostring

image

Regards
Gokul

Another way

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=identify the String\s)(\S+)|(?<=Number\sis\s)(\S+)|(?<=Location\s)(\S.+)").Tostring

Regards
Gokul

1 Like

Hi @srinusoft37

Check out the XAML file

RegexExprMatches.xaml (5.4 KB)

Expression to Get RC3.REF

System.Text.RegularExpressions.Regex.Matches(YourString,"RC3.REF|RC3.RAIL_NO|Origin Location")(0)

Expression to Get RC3.RAIL_NO

System.Text.RegularExpressions.Regex.Matches(YourString,"RC3.REF|RC3.RAIL_NO|Origin Location")(1)

Expression to Get Origin Location

System.Text.RegularExpressions.Regex.Matches(YourString,"RC3.REF|RC3.RAIL_NO|Origin Location")(2)

Regards
Gokul