Geronantimo
Technical User
First, I hope this is the appropriate board for a RegEx query...
I have a small script that takes the input from a form textarea and tries to extract all of the e-mail addresses. It works very well and the output shows each e-mail address separated with a space.
Can anybody tell me how I can get the output to be displayed with each e-mail address on a new line?
The php looks like this:
I have a small script that takes the input from a form textarea and tries to extract all of the e-mail addresses. It works very well and the output shows each e-mail address separated with a space.
Can anybody tell me how I can get the output to be displayed with each e-mail address on a new line?
The php looks like this:
Code:
$forminput .= "$_POST[emailtext]";
function extract_emails_from($string){
preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}
$text = $forminput;
$emails = extract_emails_from($text);
print(implode("\n", $emails));