Issue
I have this reg-ex to validate comma separated values:
regex = "/^[-\w\s]+(?:,[-\w\s]+)*$/"
Currently there are no special characters allowed. What modification to this can be made to allow special characters in each comma separated value?
Solution
Just add wanted special characters inside the character class like, for example:
/^[-\w\s#|@%]+(?:,[-\w\s#|@%]+)*$/
// ^^^^ ^^^^
You can add any character you want.
Answered By - Toto
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.