What are the differences between perl and java with regard to what regular expression terms are supported?
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.
Of particular interest is the partial/occasional support java has for variable length look-behinds.
Perl uses Perl regular expressions, not POSIX ones. You can compare the syntaxes yourself, for example in regex(7) .
Regular expressions can be used to perform all types of text search and text replace operations. Java does not have a built-in Regular Expression class, but we can import the java. util. regex package to work with regular expressions.
Java Regex API provides 1 interface and 3 classes in java. util. regex package.
There is a difference between Java and JavaScript regex flavors: JS does not support lookbehind. A tabulation of differences between regex flavors can be found on Wikipedia. However, this does not apply to your case.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With