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