perl和java regex功能之间有什么区别?

时间:2023-01-19 17:18:41

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

perl和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.

这个问题只局限于正则表达式,并特别排除了如何使用regex的差异——即使用regex的函数/方法——以及语言之间的语法差异,如java对转义反斜线的要求等。

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

特别值得注意的是,java对可变长度外观的部分/偶然的支持。

3 个解决方案

#1


16  

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.

java.util.regex的“与Perl 5的比较”部分。模式列出了很多差异。例如,Java不支持条件正则表达式。为此,您需要使用一些外部库,如JRegex。

#2


1  

There is a paragraph in java.util.regex.Pattern API "Comparison to Perl 5".

在java.util.regex中有一个段落。模式API“与Perl 5的比较”。

#3


1  

The slides from Tom Christiansen's OSCON talk Unicode Support Shootout: The Good, the Bad, & the (mostly) ugly cover some of the differences between Perl and Java (and other languages) regarding support of the Unicode technical recommendations for regexes, and they distinguish between Java 1.6 and 1.7 (which improves support significantly).

幻灯片从Tom Christiansen OSCON Unicode支持枪战:好的,坏的,&(大部分)丑盖之间的一些差异Perl和Java(和其他语言)对Unicode的支持技术对regex的建议,和他们区分Java 1.6和1.7(这将极大地提高支持)。

#1


16  

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.

java.util.regex的“与Perl 5的比较”部分。模式列出了很多差异。例如,Java不支持条件正则表达式。为此,您需要使用一些外部库,如JRegex。

#2


1  

There is a paragraph in java.util.regex.Pattern API "Comparison to Perl 5".

在java.util.regex中有一个段落。模式API“与Perl 5的比较”。

#3


1  

The slides from Tom Christiansen's OSCON talk Unicode Support Shootout: The Good, the Bad, & the (mostly) ugly cover some of the differences between Perl and Java (and other languages) regarding support of the Unicode technical recommendations for regexes, and they distinguish between Java 1.6 and 1.7 (which improves support significantly).

幻灯片从Tom Christiansen OSCON Unicode支持枪战:好的,坏的,&(大部分)丑盖之间的一些差异Perl和Java(和其他语言)对Unicode的支持技术对regex的建议,和他们区分Java 1.6和1.7(这将极大地提高支持)。