I need to identify all email addresses in a given cell enclosed in any special character, written in any number of multiple lines.
This is something that I built.
"(!\s<,;-)[a-zA-Z0-9]*@"
Is there any improvement?
I need to identify all email addresses in a given cell enclosed in any special character, written in any number of multiple lines.
This is something that I built.
"(!\s<,;-)[a-zA-Z0-9]*@"
Is there any improvement?
On
The pattern (!\s<,;-)[a-zA-Z0-9]*@ starts with capturing !\s<,;- literally. If you want to match 1 of the listed characters, you can use a character class [!\s<,;-] instead.
If you want to match xyz123 in [email protected] you can use:
[a-zA-Z0-9]+(?=@)
The pattern matches
[a-zA-Z0-9]+ Match 1+ occurrences of any of the listed ranges(?=@) Assert (not match) an @ directly to the right of the current positionSee a regex demo.
Use
See regex proof
EXPLANATION