RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:07pm
1
Hi Everyone,
I’m encountering an issue with my process. After extracting emails, there might be one or more emails separated by periods (e.g., dddd@gmail.com.jhjhjhh@yahoo.com.mmmdmdm@gmail.com). I need to send emails to all the extracted addresses, but I need to replace the dot between email with semicolons ( ; ) to do so.
Does anyone have any ideas on how to achieve this?
Thanks!
rlgandu
(Rajyalakshmi Gandu)
July 29, 2024, 1:14pm
2
@RPA_Dev13
System.Text.RegularExpressions.Regex.Replace("dddd@gmail.com.jhjhjhh@yahoo.com.mmmdmdm@gmail.com", "(?<=@[\w.]+)\.(?=[\w.]+@)", ";")
RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:16pm
3
But it also replaced the dot before the com!!!
rlgandu
(Rajyalakshmi Gandu)
July 29, 2024, 1:20pm
4
@RPA_Dev13
System.Text.RegularExpressions.Regex.Replace("dddd@gmail.com.jhjhjhh@yahoo.com.mmmdmdm@gmail.com", "(.com)\.(?=\w+)", ".com;")
mkankatala
(Mahesh Kankatala)
July 29, 2024, 1:21pm
5
Hi @RPA_Dev13
Use the Regular expressions to replace the dot between the emails,
- Assign -> Input = "dddd@gmail.com.jhjhjhh@yahoo.com.mmmdmdm@gmail.in.abcd@email.google.com"
- Assign -> Output = System.Text.RegularExpressions.Regex.Replace(Input.ToString, "(?<=\.com|\.in)\.", ";")
Check the below workflow for better understanding,
Hope it helps!!
RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:25pm
6
Thanks, I tested this but not all the times the emails end with .com
also come like this
e.g., (dddd@gmail.com.jhjhjhh@yahoo.ie.mmmdmdm@gmail.gr)
mkankatala
(Mahesh Kankatala)
July 29, 2024, 1:26pm
7
Have you tried this one… @RPA_Dev13
rlgandu
(Rajyalakshmi Gandu)
July 29, 2024, 1:27pm
8
@RPA_Dev13
Can you give the possibilities ,try to change the regex based on that
RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:29pm
9
there are many possibilities because received more than 200 emails daily
RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:36pm
10
I used the below:(example)
Email=(dddd@gmail.com.jhjhjhh@yahoo.ie.mmmdmdm@gmail.gr)
FirstEmailEndIndex=Email.IndexOf(“.”)
secondEmailEndIndex=Email.IndexOf(“.”, FirstEmailEndIndex+ 1)
Email=Email.Substring(0, secondEmailEndIndex) + “;” + Email.Substring(secondEmailEndIndex + 1)
and I got the correct result, but maybe there will be more than 2 emails, any suggestions?
mkankatala
(Mahesh Kankatala)
July 29, 2024, 1:42pm
11
Okay @RPA_Dev13
Try this one and let me know weather it working for all emails or not,
- Assign -> Output = System.Text.RegularExpressions.Regex.Replace(Input.ToString, "(?<=\@.*[?:\.][a-z]+)\.(?=[A-Za-z0-9\_\-]+\@)", ";")
Check the below image,
Hope it helps!!
RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:47pm
12
Invalid pattern ‘(?<=@.*[?:.][a-z]+).(?=[A-Za-z0-9_-]+@)’ at offset 38. Unrecognized escape sequence \_.
mkankatala
(Mahesh Kankatala)
July 29, 2024, 1:51pm
13
Try this one… @RPA_Dev13
- Assign -> Output = System.Text.RegularExpressions.Regex.Replace(Input.ToString, "(?<=\@.*[?:\.][a-z]+)\.(?=[A-Za-z0-9_\-]+\@)", ";")
I have changed the expression check now it’s working fine,
Hope you understand!!
RPA_Dev13
(RPA_Dev13)
July 29, 2024, 1:57pm
14
Working perfect, thanks everyone
1 Like
mkankatala
(Mahesh Kankatala)
July 29, 2024, 1:58pm
15
It’s my pleasure… @RPA_Dev13
Happy Automation!!
1 Like
system
(system)
Closed
August 1, 2024, 1:59pm
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.