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" } ?> Link to comment https://forums.phpfreaks.com/topic/116507-php-script-sort-of-like-a-javascript-script/ 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 Link to comment https://forums.phpfreaks.com/topic/116507-php-script-sort-of-like-a-javascript-script/#findComment-599094 Share on other sites More sharing options...
dezkit Posted July 25, 2008 Author Share Posted July 25, 2008 thanks a bunch Link to comment https://forums.phpfreaks.com/topic/116507-php-script-sort-of-like-a-javascript-script/#findComment-599100 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 Link to comment https://forums.phpfreaks.com/topic/116507-php-script-sort-of-like-a-javascript-script/#findComment-599103 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 Link to comment https://forums.phpfreaks.com/topic/116507-php-script-sort-of-like-a-javascript-script/#findComment-599216 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. Link to comment https://forums.phpfreaks.com/topic/116507-php-script-sort-of-like-a-javascript-script/#findComment-599219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.