note 100175 added to function.preg-match

From: Date: Wed, 29 Sep 2010 13:19:26 +0000
Subject: note 100175 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-172808@lists.php.net to get a copy of this message
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. ---- Server IP: 92.48.74.199 Probable Submitter: 81.131.227.80 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/100175 Del: integrated -- https://master.php.net/note/delete/100175/integrated Del: useless -- https://master.php.net/note/delete/100175/useless Del: bad code -- https://master.php.net/note/delete/100175/bad+code Del: spam -- https://master.php.net/note/delete/100175/spam Del: non-english -- https://master.php.net/note/delete/100175/non-english Del: in docs -- https://master.php.net/note/delete/100175/in+docs Del: other reasons-- https://master.php.net/note/delete/100175 Reject -- https://master.php.net/note/reject/100175 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172808) next »