dezkit Posted July 24, 2008 Share Posted July 24, 2008 well i want to do so when somebody submits a form with the format wrong, it will echo "Wrong format", the format has to be STEAM_0:x:y x meaning either one number of 1 or 2 y meaning any number forever <input type="text" name="steamid"> <?php if(?){ echo "right format" } else { echo "wrong format" } ?> Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted July 25, 2008 Share Posted July 25, 2008 for the ? put preg_match('%^STEAM_0:[1-2]:[0-9]+$%', $str) > 0 Quote Link to comment Share on other sites More sharing options...
dezkit Posted July 25, 2008 Author Share Posted July 25, 2008 thanks a bunch Quote Link to comment Share on other sites More sharing options...
dezkit Posted July 25, 2008 Author Share Posted July 25, 2008 btw does anybody have a good tutorial to preg_match function? google had failed Quote Link to comment Share on other sites More sharing options...
Lodius2000 Posted July 25, 2008 Share Posted July 25, 2008 i think you mean you want a tutorial on regular expressions, the php preg_ functions make use of regular expressions, but if you dont know how to create them the preg functions are useless... try googleing regular expression tutorial or regex tutorial Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted July 25, 2008 Share Posted July 25, 2008 Another good tool to use while learning regex, or even after you've learned it is regex coach... google it. 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.