cooldude832 Posted July 18, 2007 Share Posted July 18, 2007 I'm trying to make a regex test for something likeĀ N is any integer <?php $string = "ly123"//or ly543 or ly1111 or ly12 or ly1 for examples if($string = "lyNNN" || "lyN" || "lyNNNN" || lyNN"){ //do something } ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 18, 2007 Author Share Posted July 18, 2007 I tried: <?php $re = "/ly[0-9]{1,4}/"; if (eregi($re,$afid)){ ?> but that is always true Quote Link to comment Share on other sites More sharing options...
effigy Posted July 18, 2007 Share Posted July 18, 2007 preg_match('/\Aly\d{1,4}\z/', $string); Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 18, 2007 Author Share Posted July 18, 2007 thanks works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.