正则表达式可以与不同的语言一起使用吗? [英] Can regular expressions work with different languages?

查看:21
本文介绍了正则表达式可以与不同的语言一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当然,对于正则表达式来说,英语是很容易理解的,因为它最初是用于/用于开发的:

<块引用>

正则表达式能理解这个字符集吗?

法语进入一些我不确定如何匹配的重音字符 - 即 è 和 e 是否都被正则表达式视为单词字符?

<块引用>

Les expressions régulières peuvent comprendre ce jeu de caractères?

日语不包含我所知道的正则表达式单词字符来匹配.

<块引用>

正规表达は、この文字を理解でき、设定?

解决方案

简答:是的.

更具体地说,它取决于您的正则表达式引擎是否支持 unicode 匹配(如此处所述).p>

这样的匹配会让你的正则表达式变得非常复杂,所以我推荐阅读 this unicode正则表达式教程(另请注意,unicode 实现本身可能非常混乱,因此您也可以从阅读 Joel Spolsky 的 中受益文章 关于字符集的内部工作).

English, of course, is a no-brainer for regex because that's what it was originally developed in/for:

Can regular expressions understand this character set?

French gets into some accented characters which I'm unsure how to match against - i.e. are è and e both considered word characters by regex?

Les expressions régulières peuvent comprendre ce jeu de caractères?

Japanese doesn't contain what I know as regex word characters to match against.

正規表現は、この文字を理解でき、設定?

解决方案

Short answer: yes.

More specifically it depends on your regex engine supporting unicode matches (as described here).

Such matches can complicate your regular expressions enormously, so I can recommend reading this unicode regex tutorial (also note that unicode implementations themselves can be quite a mess so you might also benefit from reading Joel Spolsky's article about the inner workings of character sets).

这篇关于正则表达式可以与不同的语言一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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