RE: [PHP] Re: regex problem

From: Date: Tue, 03 Jun 2003 10:26:51 +0000
Subject: RE: [PHP] Re: regex problem
Groups: php.general 
Request: Send a blank email to php-general+get-149920@lists.php.net to get a copy of this message
> -----Original Message----- > From: Monty [mailto:monty3@hotmail.com] > Sent: 31 May 2003 21:21 > > If you want the entire string to be tested for digits, you > need to add the > length of the string to the regex pattern: > > $length = strlen($data); > preg_match("[0-9]{$length}", $data); Or anchor the pattern to both start and end of the string: preg_match("^[0-9]+$", $data); Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#149920) next »