in reply to regular expression to check if the textbox contains only special characters

I want to allow in text box can be "ABC" or comma separated list as "ABC,DEF,GHI_JKL". Don't want user to enter * or *,* or *.* to be entered in test box

Seems like your acceptable characters are A through Z and _ and ,

So, I would test for anything matches the inverse of that character set:

if ([^A-Z_,]) { # bad user input } else { # good user input }

Disclaimer: Not tested. YMMV

  • Comment on Re: regular expression to check if the textbox contains only special characters
  • Download Code