Reputation: 404
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]";
Upvotes: 6
Views: 3406
Reputation:
Either:
[a-b]|[x-z]
), or;[a-bx-z]
), or;[^c-w]
)
c
and after w
, so it's not [necessarily] the same as the former two, but this can be used as an advantage.The appropriate values of a
, b
, c
, w
, x
, and z
are left as a [trivial] exercise for the reader.
Happy coding.
Upvotes: 0
Reputation: 8198
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
Upvotes: 3