I don't know how to write my own regex.
1 RULE: I want allow: a-z, A-Z, 0-9.
new Regex("[^a-zA-Z0-9 -]");2 RULE: I want allow char:
+,-,|.
How can i combine 1st and 2nd rule?
I don't know how to write my own regex.
1 RULE: I want allow: a-z, A-Z, 0-9.
new Regex("[^a-zA-Z0-9 -]");2 RULE: I want allow char:
+,-,|.
How can i combine 1st and 2nd rule?
[^] is a negated character class and will match every thing except those that comes after ^ inside character class.
You can put all the modifiers and patterns inside a character class:
"[a-zA-Z0-9|+-]"
But note that since - uses for character range inside a character class you need to put it at the end of other patterns or escape it.