Re: Controlling just size with regular expressions

From: Date: Tue, 10 Apr 2001 02:08:02 +0000
Subject: Re: Controlling just size with regular expressions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-47921@lists.php.net to get a copy of this message
[quotes restored to bottom-posting order for clarity] In article <01A4B59FD1EBD311838100A0C98BE0D9AD58BE@chef.zootweb.com>, kjohnson@zootweb.com ("Johnson, Kirk") wrote: > > I need a regular expression that accepts *anything* without > > restrictions, > > only that the size of the string should be between (for > > instance) 0 and 9 > > characters. I know the {0,9} trick, but how do I accept > > *anything* in a form > > field? > I think [.]{0,9} will get it. That would accept any string containing a substring of 0-9 literal periods in a row. The regex for a string of exactly 0-9 characters of any kind would be "^.{0,9}$". But FWIW using strlen() instead of a regex would probably be more efficient here... -- CC

« previous php.general (#47921) next »