strategos Posted January 17, 2012 Share Posted January 17, 2012 I am a bit lost at how to create an array of valid characters or a beginning string that the input must have to be considered valid. For example, I need to compare this input "STEAM_0:1:32519047" A valid ID should always start with"STEAM_0:1:" with only numbers following after the second colon. How do I set these restrictions in my script? Quote Link to comment https://forums.phpfreaks.com/topic/255196-need-help-compare-an-input-string-with-a-set-of-valid-characters/ Share on other sites More sharing options...
AyKay47 Posted January 17, 2012 Share Posted January 17, 2012 1. notify the user by having the necessary string as the input value. 2. use a regular expression to search for the specified pattern in the string. (really, in this instance, strpos may be used.) and act accordingly. Quote Link to comment https://forums.phpfreaks.com/topic/255196-need-help-compare-an-input-string-with-a-set-of-valid-characters/#findComment-1308435 Share on other sites More sharing options...
strategos Posted January 17, 2012 Author Share Posted January 17, 2012 1. notify the user by having the necessary string as the input value. 2. use a regular expression to search for the specified pattern in the string. (really, in this instance, strpos may be used.) and act accordingly. Thank you. I figured it out. Quote Link to comment https://forums.phpfreaks.com/topic/255196-need-help-compare-an-input-string-with-a-set-of-valid-characters/#findComment-1308667 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.