Hello Zouari, Thursday, January 27, 2005, 8:53:55 AM, you wrote: Z> doesnt work ! Z> this is working fine : Z> if (eregi("^-?([1-3])+$",$x) Z> echo "x is 1 or 2 or 3"; Whoops. Sorry.. That's what I get for throwing out an answer while on the run: Try this: <?php for ($x=0; $x < 120; $x++) { if (preg_match("/^([1-9]{1}|1[0-9]{1}|20)$/",$x)) echo "It is! " . $i . "<br>"; else echo "It's not!" . $i . "<br>"; } ?> The for loop is just for show. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php