tags:

views:

43

answers:

2

Hello, I am looking for a regex query to verify a name of file and make sure that it contains only English characters, numbers or these characters [,],-, _

However it should not allow characters like these: ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ³J

Thanks

+1  A: 
^[a-zA-Z0-9.\[\]_-]+$

I've added the dot as a possibility, other than that the above requires at least one ASCII letter, digit, square bracket, underscore or dash (minus sign).

Tomalak
+1  A: 

The regex looks like this:

/^[A-Za-z0-9\[\]\-_]+$/

Note that this does not allow empty strings ;)

Franz
Remember that this only matches A to Z, a to z, [, ], -, and _.
Alexsander Akers
Remember that this was the requirement?
Franz
Forgive me for my sloppy sarcasm. Were you talking about the dot (because of the filename requirement)?
Franz