Need Help in logic

I had attached the print which has 2 text “Invoice ****** approved” and “Invoice ****** Disapproved”
Now i want only “Invoice *****” approved.
I tried MailSubject.Contains(“Invoice”) and MailSubject.Contains(“approved”) and MailStatus.Contains(“value=”“N”"")
MailSubject.Contains(“Invoice”) and MailSubject.IndexOf(“approved”)=0 and MailStatus.Contains(“value=”“N”"")

Above logic are not working in 1st one i am getting disapproved data and for 2nd one i am getting data table blank. Please suggest some other logic

Hi @Puneet_Singh1

I think u can try using this condition using if condition

System.Text.RegularExpressions.Regex.Matches(Mail.Subject.ToString,"(?=Invoice ).*(?<=approved)").Count=1

If this condition is satisfied it implies that mail contains subject Invoice ** approved
that ** implies that some invoice number

Hope the logic helps you

Regards
Nived N
Happy Automation

Not Working
Getting disapproved data see screenshot.

Hi @Puneet_Singh1
Try these two way as in if condition and see if any these condition matches for you

System.Text.RegularExpressions.Regex.Matches(MailSubject.ToString,“Invoice * approved”).Count=1

OR

System.Text.RegularExpressions.Regex.Matches(MailSubject.ToString,“Invoice [0-9\s]+approved”).Count=1

Regards

Nived N

Happy Automation

1 Like

2nd one is working thanks buddy

1 Like

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