正则表达式不区分重音? [英] Regex accent insensitive?

查看:167
本文介绍了正则表达式不区分重音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个正则表达式在C#程序。

I need a Regex in a C# program.

我已经捕捉到具有特定结构的文件的名称。

I've to capture a name of a file with a specific structure.

我用\w焦炭类,但问题是,这个类不匹配任何字符重音

I used the \w char class, but the problem is that this class doesn't match any accented char.

那该怎么办这个?我只是不希望把最常用的重音字母在我的模式,因为我们在理论上可以把每个字母每个口音。

Then how to do this? I just don't want to put the most used accented letter in my pattern because we can theoretically put every accent on every letter.

所以,我虽然有可能是语法,说我们想不敏感的情况下(或一类发生在帐户口音),或正则表达式选项,让我为区分大小写。

So I though there is maybe a syntax, to say we want a case insensitive(or a class which takes in account accent), or a "Regex" option which allows me to be case insensitive.

你知道这样的事情?

非常感谢你。

推荐答案

案例-insensite对我的作品在这个例子:

Case-insensite works for me in this example:

     string input =@"âãäåæçèéêëìíîïðñòóôõøùúûüýþÿı";
     string pattern = @"\w+";
     MatchCollection matches = Regex.Matches (input, pattern, RegexOptions.IgnoreCase);

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

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