Extract yahoo email id

Hello Team

How could we extract data in Below format

email id : aak889@yahoo.com , jenny_jeh@yahoo.com

So emails with @yahoo should be extracted

Output stored as
aak889@yahoo.com , jenny_jeh@yahoo.com

1)Could we modify below one
(?<=email id\s).*(?<=[yahoo.com])

  1. How can we handle scenario if present in this format (example typed ,)
    email id : aak889@yahoo.com , , jenny_jeh@yahoo.com

Thanks in advance

1 Like

Hi @anmita ,
I really don’t know what you want to retrieve data from yahoo mail or modify string …etc
regards,

Hi @Nguyen_Van_Luong1

We need to extract just this

aak889@yahoo.com ,aak889@yahoo.com

@anmita

System.Text.RegularExpressions.Regex.Match(InputText,“[A-Z|a-z]+.*@yahoo.com”)

Hope it helps

You need extract mail address?
Can you share your screen short?

Hi @anmita

You can use the below regular expressions to extract the required mail ID.

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“([A-z a-z 0-9]+@yahoo.com)”)

Hope it helps!!

Hope the below expression would help for the input in any format

Stroutput = String.Jojn(“,”, System.Text.RegularExpressions.Regex.Matches(“input string”, “[\s\w]+@yahoo.com”).Cast(Of System.Text.RegularExpressions.Match)().Select(Function(x) x.Value.ToString.Trim).ToArray())

Cheers @anmita

Email regexes can get a bit complicated. Not sure if you need it, but samples above do not work with for example dots and plus signs before the @. In case you want a robust email regex, you can check here:

Email Address Regular Expression That 99.99% Works. - https://emailregex.com/. Note that you can omit the validation after the @ sign, if you only need to capture yahoo.com adresses.

Thanks for quick responses everyone

Hi @Palaniyappan

It gives the message

Select is not a member of System.Text.RegularExpressions.Regex.MatchCollection

how could we resolve that

1 Like

Oh that’s a typo
I changed now

Correct one would be

String.Join(“,”, System.Text.RegularExpressions.Regex.Matches(“input string”, “[\s\w]+@yahoo.com”).Cast(Of System.Text.RegularExpressions.Match)().Select(Function(x) x.Value.ToString.Trim).ToArray())

Cheers @anmita

Hi @anmita

you can try this regex expression

String.Join(",",System.Text.RegularExpressions.Regex.Matches(str_input,"[0-9A-Za-z-_]+(?:@yahoo.com)"))

output you can see :slight_smile:

Hope the change works for u
Let us know for further clarification

Cheers @anmita

Thanks have replaced join with concat so it works

But if we try using join then there are errors in it

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