I was wondering what pattern one would use to check valid e-mails
The problem I face is that possible e-mails can start:
foo
foo.bar
foo.bar.doo
etc.
then be followed by an @
then ended with:
foo
foo.bar
foo.bar.doo
etc.
I was wondering what pattern can be used that uses each possible combination
I was hoping that it could be implemented like this:
<?
$pattern = ""; // this is the pattern
$input = "foo@bar foo.bar@foo foo@foo.bar foo.bar@foo.bar";
preg_match($pattern, $input, $matches);
for($i = 0; $i < sizeof($matches); $i++) {
echo $matches[$i] . "\n";
}
?>
Should output:
foo@bar
foo.bar@foo
foo@foo.bar
foo.bar@foo.bar