Email parser from HTML

Can you help me with a code to extract email addresses from a HTML? The html will be pasted in the text area <textarea> . On submit it should give me email addresses separated one line after the other from the code.
Who is Participating?
Beverley PortlockConnect With a Mentor Commented:
OK, Asumming that your addresses are separted by white space, I have simulated the input from the textarea in $test


$test = '

$pattern = '|\s?([-\.0-9a-z]{2,}@[-0-9a-z\.]{3,})\s?|';

preg_match_all( $pattern, $test, $matches );

print_r( $matches [1]);

Open in new window


    [0] =>
    [1] =>
    [2] =>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.