正则表达式可以与不同的语言一起使用吗?

编程入门 行业动态 更新时间:2024-10-26 05:27:43
本文介绍了正则表达式可以与不同的语言一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

法语进入一些我不确定如何匹配的重音字符 - 即 è 和 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).

更多推荐

正则表达式可以与不同的语言一起使用吗?

本文发布于:2023-10-17 13:19:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1501037.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语言   正则表达式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!