regex - Replacing all non-ASCII characters, except right angle character in C# -
writing file utility strip out non-ascii characters files. have regex:
regex rgx = new regex(@"[^\u0000-\u007f]");
which works fine. unfortunatly, i've discovered silly people use right angles (¬) delimiters in files, these stripped out well, need those!
i'm pretty new regex, , understand basics, awesome!
thanks in advance!
you need include code point angle bracket in set:
try this:
regex rgx = new regex(@"[^\uxxxx\u0000-\u007f]");
or this:
regex rgx = new regex(@"[^\uxxxx-\uxxxx\u0000-\u007f]");
(where xxxx unicode code point character want preserve.)
the reason giving 2 options here know can specify multiple ranges within 1 negative character group, don't know if can match individual characters ranges.
Comments
Post a Comment