Regular Expressions [bash]

Permabanned
Joined
21 Nov 2010
Posts
2,315
Location
Newton Aycliffe
I'm trying to match up some email addresses using regular expressions in bash.
Currently got the expression
Code:
"^[a-zA-Z0-9!#\$%&'\*\+/=?^_\`{|}~-]+(\.[a-zA-Z0-9!#\$%&'\*\+/=?^_\`{|}~-]+)*@([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\$"
Which successfully matches all the emails i need, however when trying to add the To: field i cant seem to get any matches and i'm not sure why.
This is my code with the To field.

Code:
"^To:\s[a-zA-Z0-9!#\$%&'\*\+/=?^_\`{|}~-]+(\.[a-zA-Z0-9!#\$%&'\*\+/=?^_\`{|}~-]+)*@([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\$"

Which AFAIK should match up fine with "To: [email protected]" but doesn't :(
Any advice?
 
Back
Top Bottom