I’ve got a string that contains:
@from = "John Doe <john.doe@daemon.co.uk>"
When I do:
@from.scan('/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i')
I get no results. I’m trying to extract the email address on it’s own.
I tried removing the \b’s but this did not work either.
Any help would be much appreciated.
Your expression works fine: rubular
The problem is the quotes around your regular expression means that it is interpreted as a plain text string rather than a regular expression. Removing the quotes solves the problem: ideone
Output: