anmita
September 25, 2023, 7:56am
1
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 ])
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,
anmita
September 25, 2023, 8:08am
3
rlgandu
(Rajyalakshmi Gandu)
September 25, 2023, 8:13am
4
@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?
mkankatala
(Mahesh Kankatala)
September 25, 2023, 8:18am
6
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.
anmita
September 25, 2023, 8:43am
9
Thanks for quick responses everyone
anmita
September 25, 2023, 8:43am
10
Hi @Palaniyappan
It gives the message
Select is not a member of System.Text.RegularExpressions.Regex.MatchCollection
how could we resolve that
1 Like
Palaniyappan
(Palaniyappan P )
September 25, 2023, 8:48am
11
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
Palaniyappan
(Palaniyappan P )
September 25, 2023, 9:39am
13
Palaniyappan:
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())
Hope the change works for u
Let us know for further clarification
Cheers @anmita
anmita
September 25, 2023, 10:13am
14
Thanks have replaced join with concat so it works
But if we try using join then there are errors in it
system
(system)
Closed
September 29, 2023, 11:24am
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.