Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the regex world what's a flavor and which flavor does Java use?

Tags:

I'm not a native English and so I don't understand well the meaning of 'flavor' may be is it referred to a regex syntax?? and if so how many regex syntax are there?

BRE ERE Perl etc.??

like image 527
xdevel2000 Avatar asked Jul 12 '10 06:07

xdevel2000


People also ask

What are the flavors of regular expressions?

Different Flavors of Regular Expressions Regular expressions (RE), as defined by POSIX, come in two flavors: extended regular expressions (ERE) and basic regular expressions (BRE). EREs are roughly those of the traditional egrep, while BREs are roughly those of the traditional ed.

What flavor of regex does Python use?

Python: Python's regex flavor is listed as "Python" in the table below. R: The regular expression functions in the R language for statistical programming use either the POSIX ERE flavor (default), the PCRE flavor (perl = true) or the POSIX BRE flavor (perl = false, extended = false).

Is there regex in Java?

Java does not have a built-in Regular Expression class, but we can import the java. util. regex package to work with regular expressions.

Which Java package is needed for Java regex expressions?

With Java, you can work with regular expressions using the Java. util. regex package. This package provides many classes and methods for manipulating regular expressions.


1 Answers

There are many different variations of what features a regex engine implements, what technique it uses "under the hood" and what syntax it uses for certain features.

There is a very good article and comparison table at regular-expressions.info.

The Java regex package implements a "Perl-like" regular expressions engine, but it has some extra features like possessive quantifiers (.*+) and variable-length (but finite) lookbehind assertions). On the other hand, it misses a few features Perl has, namely conditional expressions or comments. All in all, it's a very full-featured implementation.

like image 65
Tim Pietzcker Avatar answered Oct 06 '22 12:10

Tim Pietzcker