wdallman Posted May 12, 2010 Share Posted May 12, 2010 I need to make a regular expression that will return valid anything not equal to 'select'. I'm using it to validate a form that has dropdown boxes that are defaulted on 'select'. If they have chosen anything at all, it will not equal 'select', and is therefore valid. I'm not familiar at all with creating expressions, so my last try looked like... /(?!select)/ Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 13, 2010 Share Posted May 13, 2010 You don't need regular expressions for that! Just use if (fieldValue == 'select') { //error condition } else { //value is valid } However, I would suggest just making the default select value an empty string rather than the string 'select' Quote Link to comment Share on other sites More sharing options...
wdallman Posted May 13, 2010 Author Share Posted May 13, 2010 yes, you're right. I did it without a regular expression. Thank you!! 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.