Daniel Israel wrote:
>
>
>
> Greetings gang. Looking for a little help with regular expressions
> that I suck at... :(
>
> I have a page where the user can enter a number of email addresses
> separated by white space, comma, or semi-colon. I found some code on
> the PHP site to split it by comma and/or whitespace, but I wanted to
> add semicolon. It looks like so:
>
> $email = preg_split("/[\s,]+/", $entry);
>
> So I tried:
>
> $email = preg_split("/[\s,;]+/", $entry);
>
> and it seemed to ignore the semicolon. Any help would be
> appreciated. Thanks.
>
I just tried the following and it worked fine for me:
[EMAIL PROTECTED]:~$ less test.php
<?php
$emails = '[EMAIL PROTECTED] ; [EMAIL PROTECTED] , [EMAIL PROTECTED]
[EMAIL PROTECTED]';
print_r(preg_split('/[\s,;]+/',$emails));
?>
[EMAIL PROTECTED]:~$ php test.php
Array
(
[0] => [EMAIL PROTECTED]
[1] => [EMAIL PROTECTED]
[2] => [EMAIL PROTECTED]
[3] => [EMAIL PROTECTED]
)
If you are not getting this result then there is a bug somewhere else in
your code or perhaps (yet less likely) there is a bug in your version of
php.
Billy P.