I'm trying to learn regular expressions. I was testing myself by trying to check an email account. The problem though is it's coming up with an error:
No ending delimiter '^' found in /www/eh11522/public_html/scclib/demo/regex.php on line 8
Here is my code:
<?php
$pattern = "^([\w.]+)@w([\w.]+).([\w.]+)";
$email = "tyler@surazinet";
if (!preg_replace($pattern, '', $subject)) {
echo "worked";
} else {
echo "failed";
}
?>
I found that it will work if I put a slash before and after the pattern, but I don't quite understand what that does, and that doesn't quite match what I want it to.