Value Extraction From Email Body

Hi I want to Extract the Specific Value from Email BODY.

The body looks like

Hi welcome to our company

The details are as follows

There are few Rules : shown below

Attached is a quotation # RFQ12345-01

Please see the Screen shot below ; 123456

I would like to Extract the value RFQ12345-01. Some time the Value should be RFQ12345 only.

Please help me on this Extraction

Thanks in Advance

1 Like

@srinusoft37 You can use this Regular Expression

Assign str_variable = System.Text.RegularExpressions.Regex.Match(ur_variable," (\w{3}\d{5}[-]\d{2}|\w{3}\d{5})").ToString

1 Like

Hi Indra,

If I use the same in the My Email Body I am getting the Different value. This is Highlighting in the Regex Editor.

the Body looks like this

Attached is a quotation # RFQ12345-001
The end Customer is : International
The customer locations is in : US
This is a Bid foe Mfg site: DG
The Product names are: ABCD

Pleas note the below values for further reference

I need to extract the RFQ12345-001 alone
and this four lines

The end Customer is : International
The customer locations is in : US
This is a Bid foe Mfg site: DG
The Product names are: ABCD

I find some other alternate for this RFQ12345-001 but the 4 lines I am facing error

Kindly help me on this.

Thanks in advance

1 Like

@srinusoft37 Can you share the extracted string after The Product names are: ABCD this lines what you are getting

After that we have some Description Indra. like
Please read the below instruction for the following while submitting: like this we have some other description

I used the code like (?<= The customer locations is in :).* but I am getting the value as US
as output

Thanks

1 Like

@srinusoft37 you can replace new line with space and apply regex

System.Text.RegularExpressions.Regex.Match(str_data.Replace(Environment.NewLine," β€œ),”(?<=quotation #).*(?=Please)").ToString.Trim

1 Like

Thanks for the quick Reply.

The output I required is I need the each line in different values Indra.

May be I convey in wrong way earlier for your understanding.

Sorry for that.

I need the output as

Value1: The end Customer is : International

Value 2: The customer locations is in : US

Value 3:This is a Bid foe Mfg site: DG

Value4 : The Product names are: ABCD

I need this 4 lines in 4 different variables

Thanks

You can refer below screenshot

For each four variable create separate regex

Value1 = System.Text.RegularExpressions.Regex.Match(str_data,β€œ(The end).β€œ).ToString
Value2 = System.Text.RegularExpressions.Regex.Match(str_data,”(The customer).
”).ToString
Value3 = System.Text.RegularExpressions.Regex.Match(str_data,β€œ(This is a).β€œ).ToString
Value4 = System.Text.RegularExpressions.Regex.Match(str_data,”(The Productr).
”).ToString

1 Like

What is the Str_Data we have to take… here Indra

Thanks

Str_data is your variable

1 Like

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