正则表达式可以与其他语言一起使用吗? [英] Can regular expressions work with different languages?
问题描述
当然,英语对regex毫无疑问,因为它最初是在以下语言/中开发的:
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?
法语遇到了一些重音符号,我不确定该如何与之匹配-即è和e都被正则表达式视为单词字符?
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 Expressionsrégulièrespeuvent comprendre ce jeu decaractères?
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.
距离表现は,この文字を理解でき,设定?
正規表現は、この文字を理解でき、設定?
推荐答案
简短答案:是.
具体来说,这取决于您的正则表达式引擎是否支持unicode匹配(如此处所述).
More specifically it depends on your regex engine supporting unicode matches (as described here).
此类匹配会极大地使您的正则表达式复杂化,因此我建议阅读此 unicode regex教程(还请注意,Unicode实现本身可能很混乱,因此您也可以从阅读Joel Spolsky的有关字符集内部工作的文章).
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屋!