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
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 :
@avinash_ghanwat1
Please use-
System.Text.RegularExpressions.Regex.Match(str,"(?<=Method claim was submitted (.*):)(.*)").Value
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
@avinash_ghanwat1 Try with this regex now
(?<=(?<=Method claim was submitted )|:) [A-Za-z]+
Regards,
1 Like
system
(system)
Closed
September 30, 2023, 9:55am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.