note 100175 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Sep 2010 16:57:13 +0000 |
| Subject: | note 100175 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172810@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
In reply to: clbmuvn at gmail dot com
First off it looks like your putting white space in your regex (the new lines) which means the
engine is looking for them in the subject string.
Secondly the + character means repeated 1 or more times so I don't think this is going to do
what you want and will match an infinitely long string of ones and zeros what you probably want to
match is:
(00[01]{6}){3}00
far easier to understand. Two zeros followed by six ones or zeros, repeat this pattern three times
followed by two zero characters. If you want to make sure the whole string matches this pattern:
^(00[01]{6}){3}00$
Thirdly (as a side note) you don't need the 'i' at the end since your only dealing
with digits.