|
Posted by John Nichel on 09/06/05 21:21
babu wrote:
> Hi all,
>
>
> I want to write regular expression for checking the string format entered by user.
>
> the allowed formats are
>
> examples:
> 10
> 10,
> 10,12-10
> 12-10
>
> that is the valid strings are:
> 1. only integer
> 2. an integer, range of integers example 3
>
> and no other characters must be allowed.
Crude, but it will work....
preg_match ( "/^[-0-9,]+$/", $value )
It will also match just dashes and/or just comma's with no numbers.
http://us2.php.net/manual/en/reference.pcre.pattern.syntax.php
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com
Navigation:
[Reply to this message]
|