perl 和 java 正则表达式功能之间有什么区别? [英] What are the differences between perl and java regex capabilities?

查看:32
本文介绍了perl 和 java 正则表达式功能之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在支持哪些正则表达式术语方面,perl 和 java 之间有什么区别?

What are the differences between perl and java with regard to what regular expression terms are supported?

这个问题仅与正则表达式隔离,并且特别排除了如何使用正则表达式的差异 - 即使用正则表达式的可用函数/方法 - 以及语言之间的语法差异,例如java要求转义反斜杠等

This question is isolated to just the regular expressions, and specifically excludes differences in how regex can be used - ie the functions/methods available that use regex - and syntactic differences between the languages such as the java requirement to escape backslashes etc.

特别令人感兴趣的是 java 对可变长度后视的部分/偶尔支持.

Of particular interest is the partial/occasional support java has for variable length look-behinds.

推荐答案

java.util.regex.Pattern 列出了许多不同之处.例如,Java 不支持条件正则表达式.为此,您需要使用一些外部库,例如 JRegex.

The "Comparison to Perl 5" section of java.util.regex.Pattern lists many differences. For example, Java does not support conditional regex. For that, you need to use some external library like JRegex.

这篇关于perl 和 java 正则表达式功能之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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