Mega Code Archive
Matching using backreferences
$ok_html = "I love shrimp dumplings.";
if (preg_match('@<[bi]>.*?[bi]>@',$ok_html)) {
print "Good for you! (OK, No backreferences)\n";
}
if (preg_match('@<([bi])>.*?\\1>@',$ok_html)) {
print "Good for you! (OK, Backreferences)\n";
}
?>