note 100867 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Thu, 11 Nov 2010 19:35:00 +0000 |
| Subject: | note 100867 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173957@lists.php.net to get a copy of this message | ||
Note Submitter: rothe at NOSPAM dot com
----
clbmuvn, that regex is not what you want. The '+' does not concatenate parts. You want
<?php
$str ='/^00([01]{6}00){3}/';
if ((preg_match($str,"00000000000000000000000000")))
{echo "OK";}
?>
which is just shorthand for
<?php
$str ='/^00[01][01][01][01][01][01]00[01][01][01]
[01][01][01]00[01][01][01][01][01][01]00/';
if ((preg_match($str,"00000000000000000000000000")))
{echo "OK";}
?>