Extract Emails from Text

Extract all email addresses from a text string.

Code

General
echo "$text" | grep -oE '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' | jq -R -s 'split("\n") | map(select(length > 0))'

Parameters

Text containing emails

Server

More Bash Snippets