Gabotronix
1 month ago

preg_match_all equivalent in javascript?

Posted 1 month ago by Gabotronix

Hi everybody, I want to grab all emails inside a DOM string I get like this:

document.documentElement.outerHTML

I have the following regex from an old PHPproject:

"/([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/i"

How can I check for all matches in the whole html string? preferably pushing each match into an array would be best!

Please sign in or create an account to participate in this conversation.