Re: [PHP] regex usage

2008-02-18 Thread Richard Lynch
On Sun, February 17, 2008 9:34 am, Valedol wrote: > Is there a mothod to check string`s length with regex or the only way > is > using strlen? > > I want string consisting of 4 digits > and check string with this code: > > if (preg_match("/\d{4}/",$_POST[id])) > { echo $_POST[id]; } > > but preg_

Re: [PHP] regex usage

2008-02-17 Thread Jim Lucas
Valedol wrote: Is there a mothod to check string`s length with regex or the only way is using strlen? I want string consisting of 4 digits and check string with this code: if (preg_match("/\d{4}/",$_POST[id])) { echo $_POST[id]; } but preg_match returns true when string consists of 4 or more

Re: [PHP] regex usage

2008-02-17 Thread Nirmalya Lahiri
--- Valedol <[EMAIL PROTECTED]> wrote: > Is there a mothod to check string`s length with regex or the only > way is > using strlen? > > I want string consisting of 4 digits > and check string with this code: > > if (preg_match("/\d{4}/",$_POST[id])) > { echo $_POST[id]; } > > but preg_match

Re: [PHP] regex usage

2008-02-17 Thread Richard Heyes
Is there a mothod to check string`s length with regex or the only way is using strlen? I want string consisting of 4 digits and check string with this code: if (preg_match("/\d{4}/",$_POST[id])) { echo $_POST[id]; } but preg_match returns true when string consists of 4 or more digits You co

Re: [PHP] regex usage

2008-02-17 Thread Shawn McKenzie
Valedol wrote: > Is there a mothod to check string`s length with regex or the only way is > using strlen? > > I want string consisting of 4 digits > and check string with this code: > > if (preg_match("/\d{4}/",$_POST[id])) > { echo $_POST[id]; } > > but preg_match returns true when string cons