Hello,
I am trying to extract the email id.
Text:
2dbccf5bc0de_327050.0670_sun_engineer@sun.com
4bb1-a91d-23bd336d7b1e_362833.0120_Steffi.Gill@kjhk-one.de
My expression to split is:
Mystring.ToString.Split("_"c)(1).ToString
It works for the second one but not for the first one as I only get sun as an output.
I tried Regex : “[a-zA-Z0-9-.]+@[a-zA-Z-]+.[a-z]{2,}”
but I get only “engineer@sun.com”.
How can it work for both the expression.
lrtetala
(Lakshman Reddy)
4
@parnalmahavir.patni
System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+_).*").Value
Regards,
It shows error
Assign: Invalid pattern ‘(?<=_)[A-Za-z]+.*’ at offset 6. Unrecognized escape sequence \_.
vrdabberu
(Varunraj Dabberu)
7
Hi @parnalmahavir.patni
Can you try the below regular expression:
System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+_)[a-zA-Z0-9-._]+@[a-zA-Z-]+.[a-z]{2,}").Value.Trim()

Regards
lrtetala
(Lakshman Reddy)
8
@parnalmahavir.patni
How about the following?
((?<=\d{4,}_)[A-Za-z]+.*)
Regards,
1 Like
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.