Replace the dot between emails with(;) after extracted

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!

@RPA_Dev13

System.Text.RegularExpressions.Regex.Replace("dddd@gmail.com.jhjhjhh@yahoo.com.mmmdmdm@gmail.com", "(?<=@[\w.]+)\.(?=[\w.]+@)", ";")

But it also replaced the dot before the com!!!

@RPA_Dev13

System.Text.RegularExpressions.Regex.Replace("dddd@gmail.com.jhjhjhh@yahoo.com.mmmdmdm@gmail.com", "(.com)\.(?=\w+)", ".com;")

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!!

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)

Have you tried this one… @RPA_Dev13

@RPA_Dev13

Can you give the possibilities ,try to change the regex based on that

there are many possibilities because received more than 200 emails daily

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?

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!!

Invalid pattern ‘(?<=@.*[?:.][a-z]+).(?=[A-Za-z0-9_-]+@)’ at offset 38. Unrecognized escape sequence \_.

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!!

Working perfect, thanks everyone

1 Like

It’s my pleasure… @RPA_Dev13

Happy Automation!!

1 Like

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