sKunKbad Posted August 30, 2009 Share Posted August 30, 2009 I'm trying to validate a string, but it isn't working. It's probably the regex... but I copied and pasted it from php. So there's probably a difference between the way php uses this regex vs. javascript. Can somebody point out the error please: var myMesgRegex = /^[^-\s A-Z0-9~!@#$%^&*()_+=;:\'",.?|}{[\]\/\\\\]*$/i; var matchPos3 = mesg.search(myMesgRegex); if (mesg !== ''){ if (matchPos3 !== -1){ mesgIsGood = 'yes'; }else{ mesgIsGood = 'no'; } }else{ mesgIsGood = 'no'; } 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.