范围大于127的正则表达式模式 [英] regex pattern for a range and above 127

查看:156
本文介绍了范围大于127的正则表达式模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个正则表达式,使其匹配以下内容以及127以上的所有ascii(即7F十六进制及以上)。

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]";


推荐答案

尝试使用or运算符| (管道)

Try the or operator | (pipe)

string pattern = "[\x00-\x1f]|[\x7f-\uffff]";

FF十六进制为最大ASCII值。

FF hex would be the max ASCII value.

以下是备忘单,以供进一步参考:
http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet

Here's a cheat sheet for further reference: http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet

这篇关于范围大于127的正则表达式模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆