williamsandonz
williamsandonz

Reputation: 16440

How can I get this regex to allow spaces

I have a regex:

Regex strPattern = new Regex(@"^[]0-9A-Za-z&[@!*(){}:?.,^%#$~`;'_/\\-]*$");

I'd like it to allow spaces (any sequence of) but everytime I try to put it in here somewhere, it screws it all up. How do I get it in here? thanks!

Upvotes: 1

Views: 73

Answers (1)

Felipe Pereira
Felipe Pereira

Reputation: 12320

I guess this should work

Regex strPattern = new Regex(@"^[]0-9A-Za-z &[@!*(){}:?.,^%#$~`;'_/\\-]*$");

Upvotes: 3

Related Questions