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'; } Link to comment https://forums.phpfreaks.com/topic/172442-validating-string-for-my-keyboard-charset-only-minus-gt-and-lt/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.