regex pattern for a range and above 127
问题 I need a regex such that it matches following plus anything ascii above 127 (i.e 7F hex and above). Below works fine for the given range. string pattern = "[\x00-\x1F]"; 回答1: Try the or operator | (pipe) string pattern = "[\x00-\x1f]|[\x7f-\uffff]"; FF hex would be the max ASCII value. Here's a cheat sheet for further reference: http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet 回答2: Either: Accept characters in both ranges (with an alternation, [a-b]|[x-z] ), or