backrefs in ereg() and preg_match() (was Bug #3014)
| From: | Chad Miller | Date: | Tue, 21 Dec 1999 04:00:12 +0000 |
| Subject: | backrefs in ereg() and preg_match() (was Bug #3014) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-13891@lists.php.net to get a copy of this message | ||
Hi, all. I'll be on the dev list, soon.
Consider this code, under 4.0b3:
#! php -q
<?php
$address = "AB:BC:CD:DE:EF:AF";
if (preg_match("/^[A-F]{2}([-:;,]?)([A-F]{2}\\1){4}[A-F]{2}$/", $address)) {
printf("preg_match matches '%s'\n", $address);
} else {
printf("preg_match !matches '%s'\n", $address);
}
if ( ereg("^[A-F]{2}([-:;,]?)([A-F]{2}\\1){4}[A-F]{2}$", $address)) {
printf("ereg matches '%s'\n", $address);
} else {
printf("ereg !matches '%s'\n", $address);
}
?>
output:
> preg_match matches 'AB:BC:CD:DE:EF:AF'
> ereg !matches 'AB:BC:CD:DE:EF:AF'
- chad