hassank1 Posted December 29, 2008 Share Posted December 29, 2008 Hi I need a function that would return true if user input alphanumeric and/or . , space , & any other character will return false Quote Link to comment https://forums.phpfreaks.com/topic/138729-input-validation/ Share on other sites More sharing options...
rhodesa Posted December 29, 2008 Share Posted December 29, 2008 function validate ( input ) { return new Boolean(input.match(/^[a-zA-Z\d. &]+$/)); } Quote Link to comment https://forums.phpfreaks.com/topic/138729-input-validation/#findComment-725324 Share on other sites More sharing options...
hassank1 Posted January 2, 2009 Author Share Posted January 2, 2009 what regular expression should I do to check if : input start and end with a digit and contains only digits or , ex: accepted : "123,232,1232" or "2324" rejected : ",4343" or "3434," or "," etc.. Quote Link to comment https://forums.phpfreaks.com/topic/138729-input-validation/#findComment-727984 Share on other sites More sharing options...
rhodesa Posted January 2, 2009 Share Posted January 2, 2009 /^\d+(,\d+)*$/ Quote Link to comment https://forums.phpfreaks.com/topic/138729-input-validation/#findComment-728098 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.