Hi All,
I have email as attched in that i need to check whether Name and Email Address are matching or not.
Sometime the Name contains three words as well.
Hi All,
I have email as attched in that i need to check whether Name and Email Address are matching or not.
Sometime the Name contains three words as well.
Can you give sample outputs
I need to check whether name and Email is matching
@ManjuNarasappa
Take an if activity
in that condition fields you can pass below regex pattern
System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Name:\s*)(.*)β).ToString.ToLower.Trim.Replace(" β,ββ) = System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Email:\s)[^@\s]+β).ToString.Trim.ToLower.Replace(β.β,β")
Here this will first extract the name from input data as Manjusree Ramapura Narasappa and it will convert to all characters to lower and remove the space between of the words. Final output will be for the name
manjusreeramapuranarasappa
and coming to email
it will extract before of the @ and convert it lower and remove the dots(.)
manjusreeramapuranarasappa
now it will compare both are same or not.
Better to extract name and then search it in email
assume str is where the string is stored
str.Split({"Name:"},StringSplitOptions.None)(1).Split({"Email Address:"},StringSplitOptions.None)(0).Trim
- this will give full name
str.Split({"Email Address:"},StringSplitOptions.None)(1).Split({"Date Entered:"},StringSplitOptions.None)(0).Trim
- this will give email
now you can usefullnamevariable.Split(" "c).All(function(x) emailvariable.ToLower.Contains(x.ToLower))
- this will give true if full name is present in email else false
cheers
You appear to be sharing details of a real persons email address of someone who works for the American Heart Association.
I think they would be quite annoyed you are sharing their name and email publically like this and you might be violating some local company policies doing so.
I suggest you remove these screenshots and in the future use dummy data.
What is the use case you are trying to solve here? I donβt think any RPA bot could be able to match this name and email address because there could any possible emails user choose. There is no rule to include your names only in the mail address.
RPA bot can be rule based, we canβt really code it to guess if the user name and email id are correct. I would suggest to try GenAI activity for this.
Did you tried this
System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Name:\s*)(.*)β).ToString.ToLower.Trim.Replace(" β,ββ) = System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Email:\s)[^@\s]+β).ToString.Trim.ToLower.Replace(β.β,β")
extract name and email from the email, split the name into words, then compare the parts with the email address to check if they match.
It works when
Name : Manjusree Ramapura Narasappa
Email Address: Manjusree.RamapuraNarasappa@gmail.com
But is not working when the data as below and giving as False
Name : Vinay Prasad RN
Email Address: t-Vinay.Prasad.RN@gmail.com
Please suggest how to remove t- if is there and check for the match
Hey @ManjuNarasappa, Similar to β.β , you can replace any unwanted text as below
Try this for email-
System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Email:\s)[^@\s]+β).ToString.Trim.ToLower.Replace(β.β,ββ).Replace(βt-β,ββ)
Okay lets add some pattern to remove before - data, just replace t- is not good solution, in the place t it may come other data then we take reference - based on - we need to remove before of the data.
try with below code
System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Name:\s*)(.*)β).ToString.ToLower.Trim.Replace(" β,ββ) =
System.Text.RegularExpressions.Regex.Match(strValue, β(?<=Email:\s)[\w.-]+@[\w.-]+.\w+β).ToString.Trim.ToLower.Split(β-βc).Last().Split(β@βc)(0).Replace(β.", ββ)
it can solve your problem!
If you got your solution, if you dont have further questions mark this post as solution to close this topic.
Happy Automation!!
Appriciated your support
I want to remove only t- and check the mail address.but If the mail address like below bot is going to else part and throwing error.
for eg:
Name : Vinay Prasad-RN
Email adres: Vinay.Prasad-RN@gmail.com
Bot extracting name as : VinayPrasad-RN and Email as : RN
Please sujest only to remove t- in the starting of the email
Hello @ManjuNarasappa
Use these two assign activities
Assign-1
emailRaw = System.Text.RegularExpressions.Regex.Match(strValue, β(?<=Email Address:\s)[\w.-]+@[\w.-]+.\w+β).Value.Trim
Assign-2
str_Email_Id = If(emailRaw.StartsWith(βt-β), emailRaw.Substring(2), emailRaw)
str_Email_Id will be your value.
@ManjuNarasappa
Then you can simply add one more replace for above script,
System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Name:\s*)(.*)β).ToString.ToLower.Trim.Replace(" β,ββ) = System.Text.RegularExpressions.Regex.Match(strValue,β(?<=Email:\s)[^@\s]+β).ToString.Trim.ToLower.Replace(β.β,ββ).Replace(βt-β,β")
Use this script and let me know, if still any issues come
If you dont have furhter questions please mark it as solution to close this topic.
Happy Automation!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.