RegEx with exceptions
I am totaly new to RegEx, but I need to extract emails with RegEx from text file
1. “@”symbol has been substituted for “ at ”,"AT" or "(at)"
2. I do not need any email with domain "myoldcompany"
I found that with these I can found any emails:
How to do the following?
Thanks for any help.
My understanding is that you are looking for email addresses.
Your regex will probably match a majority of email addresses, but will also probably miss many, as email addresses can be much more complicated that what you seem to think (check RFC 2822).
I would suggest that you use the following module: Regexp::Common::Email::Address.
A couple of years ago, I had to develop a program for validating email addresses where I could not rely on this module (because the validation rules imposed by the client were too specific in the context), I can tell you that you can quickly get into headaches. Use that module if you can.
Regexp::Common::Email::Address doesn't appear to be maintained any longer. At least no updates since Jan 2005.
Another option would be Email::Addrress which is currently being maintained.