c# - How to allow esc secuence charater in existing alphanumeric validation expression -
I only use the following validation expression to validate the string to accept alphanumeric characters
(?! ^ [0-9] * $) (? ^ [[A-zA-Z] * $) ^ ([a-zA-Z0- 9] {6,50}) $ But it does not accept characters like ~,!, (), [,], {,} etc., I accept all these characters How do I add above expression? Thank you,
You can use them for each character.
Example (Requires repeat for all character types):
string pattern = "(?" + Regex.Escape ("!") + "^ [0-9] * $) (?! ^ [A-zA-Z] * $) ^ ([one-zA-Z0-9] {6,50}) $ ";
Comments
Post a Comment