note 100867 added to function.preg-match
| From: | rothe at NOSPAM dot com | Date: | Thu, 11 Nov 2010 19:04:32 +0000 |
| Subject: | note 100867 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173956@lists.php.net to get a copy of this message | ||
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";}
?>
----
Server IP: 192.41.42.26
Probable Submitter: 71.67.99.113
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/100867
Del: integrated -- https://master.php.net/note/delete/100867/integrated
Del: useless -- https://master.php.net/note/delete/100867/useless
Del: bad code -- https://master.php.net/note/delete/100867/bad+code
Del: spam -- https://master.php.net/note/delete/100867/spam
Del: non-english -- https://master.php.net/note/delete/100867/non-english
Del: in docs -- https://master.php.net/note/delete/100867/in+docs
Del: other reasons-- https://master.php.net/note/delete/100867
Reject -- https://master.php.net/note/reject/100867
Search -- https://master.php.net/manage/user-notes.php