http://www.perlmonks.org?node_id=732862


in reply to grep question using multiple lines

This seems to work, though it assumes that there is no more than one address per line:
^.*constant=(\w+@\w+\.\w+).*|^.*\r
replaced by "\1". You can use "Replace All" and get the result you want. If you are willing to accept a multi-step solution, you can make this more robust and easily eliminate the assumption of no more than one address per line.

In my usage, I'd be inclined to use a regex in "Process Lines Containing..." to eliminate lines without an email address. I'd then extract the email addresses from the remaining lines with a regex. I believe all of this could be automated in a BBEdit Text Factory.