.net - Why can't I match POSIX Character Classes -
the following snippet prints false
:
console.writeline(regex.ismatch("abc", @"[[:alpha:]]"));
but prints true
:
console.writeline(regex.ismatch("abc", @"[a-za-z]"));
why? shouldn't equivalent?
.net regexes don't support posix character classes. support unicode groups.
this work:
regex.ismatch("abc", @"^\p{l}+$");
the \p{l}
group matches unicode letters.
see here more information:
http://msdn.microsoft.com/en-us/library/20bw873z.aspx#categoryorblock
Comments
Post a Comment