Regex expression for "Method claim was submitted"

Hi Team,

Please find below requirement I want to extract "Method claim was submitted : " from email body, but the email can have two different formats,

Format1:
Method claim was submitted : Fax

Format2:
Method claim was submitted (Fax,Mail,Electronic) : Fax

The bot should be able to extract whatever mentioned after “:” from the email body in our case it should be “Fax”.

Can anyone please help me with this issue.

@avinash_ghanwat1

System.Text.RegularExpressions.Regex.Match(inputStr,“(?<=:\s).*”).value

1 Like

(?<=(Method claim was submitted).*:\s+)[A-Za-z]+

Follow this regex pattern
image

Let me know if it works! @avinash_ghanwat1 Regards

1 Like

Could you please add those Keywords Method claim was submitted, as in email there are many more lines with :

You can try this

@avinash_ghanwat1

2 Likes

@avinash_ghanwat1
Please use-

System.Text.RegularExpressions.Regex.Match(str,"(?<=Method claim was submitted (.*):)(.*)").Value

image

1 Like

@tazunnisa.badavide : I am getting pattern error while I am testing it on Regex 101 Please fine below screenshot for reference

you can try this syntax it will match all the fax even the format change

System.Text.RegularExpressions.Regex.Match(str12,"(?<=[Method claim was submitted|Method claim was submitted (Fax,Mail,Electronic)\s*]:).*").Value.Trim

output : regex builder

sytaxn in studio output:

@avinash_ghanwat1

1 Like

could you please try with below syntax-

System.Text.RegularExpressions.Regex.Match(“Method claim was submitted (Fax,Mail,Electronic) : Fax”,“(?<=Method claim was submitted).*”).Value.Split(":"c).Last.trim

It may be any string after ,“Method claim was submitted” above syntax will works.
as we are spliting with “:” and getting the last word

HopeItHelps…

1 Like

[A-Za-z]+$
try with ths

1 Like

@avinash_ghanwat1 Try with this regex now
(?<=(?<=Method claim was submitted )|:) [A-Za-z]+

image

Regards,

1 Like

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