note 100747 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Thu, 04 Nov 2010 15:16:58 +0000 |
| Subject: | note 100747 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173759@lists.php.net to get a copy of this message | ||
Note Submitter: amigojack at gmx dot net
----
@clbmuvn at gmail dot com, 25-Sep-2010 03:42: Unless you really need all the repeatings (and I
assume you only need a pattern without all the pluses) you must specify an ungreedy mode:
<?php
$str ='/^00+[0-1]+[0-1]+[0-1]
+[0-1]+[0-1]+[0-1]+00+[0-1]+
[0-1]+[0-1]+[0-1]+[0-1]+[0-1]+00+
[0-1]+[0-1]+[0-1]+[0-1]+[0-1]+[0-1]+00/Ui';
if ((preg_match($str,"00000000000000000000000000")))
{echo "Oh - it works";}
?>