Exclude caracters from \W

3665 views regex
2

I want to know if it's possible to exclude some special characters from \W in RegExp.

For example, I want to allow sentences with ? or , or ! or ç, space and so on... If I use \W_ it'll match all special characters! There's a way to exclude ?, ,, !, ç etc.?

You know, exactly like it's possible to add _ to \W...

Is there's a simple way to exclude characters from it?

answered question

1 Answer

0

You can just use [^\w ?!ç], etc.

posted this

Have an answer?

JD

Please login first before posting an answer.