Reputation: 40395
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
Upvotes: 0
Views: 387
Reputation: 11553
The regex looks like this:
/^[A-Za-z0-9\[\]\-_]+$/
Note that this does not allow empty strings ;)
Upvotes: 1
Reputation: 338208
^[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).
Upvotes: 1