i'm trying pattern says:
only numbers a-z a-z 0-9 . + - %
are wrong, code:
string regex = "[^a-za-z0-9_\\.+-\\%]";
i'm getting exception illegal character range near index 17 @ 17 index have %, doing wrong?
you don't need escape %
in regular expression. remove \
before it.
you shouldn't escaping .
. there's no need inside character class: inside character class, means literal .
character, not "any character".
but do need escape -
, mean literal -
, rather character range.
string regex = "[^a-za-z0-9_.+\\-%]";
Comments
Post a Comment