正则表达式可以用于不同的语言吗? [英] Can regular expressions work with different languages?
问题描述
当然,英语对于正则表达式来说是轻而易举的,因为它最初是在/用于开发的:
<块引用>正则表达式能理解这个字符集吗?
法语进入了一些我不确定如何匹配的重音字符 - 即 è 和 e 是否都被正则表达式视为单词字符?
<块引用>Les expressions régulières peuvent comprendre ce jeu de caractères?
日语不包含我所知道的要匹配的正则表达式单词字符.
<块引用>正规表现は、この文字の理解でき、设定?
简短回答:是.
更具体地说,这取决于您的正则表达式引擎支持 unicode 匹配(如此处所述).>
这样的匹配会让你的正则表达式变得非常复杂,所以我推荐阅读this unicoderegex 教程(另请注意,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屋!