pankajs3
(pankaj)
1
given string find only email address only using regex matching
from string:("Abc Ram" <abcr@abc.com>)
find : “(arunr@abc.com)”
email id can be any type like
“aa.bb@cc.co”
“aa_bb@ccc.co.in”
“abc17a@cc.com”
“av_17@c.co.in”
but common thing is between “<>”
Hey @pankajs3
You can use below Regex-
(([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|([\w-]+\.)+)[a-zA-Z]{2,4}|[0-9]{1,3}\]?)
Reference Link - regex101: build, test, and debug regex
Above Regex will return you Groups just capture first group to get your email address from string.
Regards…!!
Aksh
1 Like
pankajs3
(pankaj)
3
@aksh1yadav i have to find out only between data lessthan(<) and greater than(>)
<------> to ------
Hey @pankajs3
just add < at the beginning of regex and > at the end of it
<(([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|([\w-]+\.)+)[a-zA-Z]{2,4}|[0-9]{1,3}\]?)>
Link - regex101: build, test, and debug regex
Regards…!!
Hi @pankajs3
Check below screenshot for find the solution.

1 Like