Parts of the ApiDoc of the Pattern Class
http://java.sun.com/docs/books/tutorial/extra/regex/pattern.html
Perl constructs not supported by this class:
The conditional constructs (?{X}) and (?(condition)X|Y),
The embedded code constructs (?{code}) and (??{code}),
The embedded comment syntax (?#comment), and
The preprocessing operations \l \u, \L, and \U.
Constructs supported by this class but not by Perl:
Possessive quantifiers, which greedily match as much as they can and do not back off, even when doing so would allow the overall match to succeed.
Character-class union and intersection as described above.
Notable differences from Perl:
In Perl, \1 through \9 are always interpreted as back references; a backslash-escaped number greater than 9 is treated as a back reference if at least that many subexpressions exist, otherwise it is interpreted, if possible, as an octal escape. In this class octal escapes must always begin with a zero. In this class, \1 through \9 are always interpreted as back references, and a larger number is accepted as a back reference if at least that many subexpressions exist at that point in the regular expression, otherwise the parser will drop digits until the number is smaller or equal to the existing number of groups or it is one digit.
Perl uses the g flag to request a match that resumes
where the last match left off. This functionality is provided implicitly
by the Matcher
class: Repeated invocations of the find
method will resume where the last match left off,
unless the matcher is reset.
In Perl, embedded flags at the top level of an expression affect the whole expression. In this class, embedded flags always take effect at the point at which they appear, whether they are at the top level or within a group; in the latter case, flags are restored at the end of the group just as in Perl.
Perl is forgiving about malformed matching constructs, as in the
expression *a, as well as dangling brackets, as in the
expression abc], and treats them as literals. This
class also accepts dangling brackets but is strict about dangling
metacharacters like +, ? and *, and will throw a
PatternSyntaxException
if it encounters them.
For a more precise description of the behavior of regular expression constructs, please see Mastering Regular Expressions, 2nd Edition, Jeffrey E. F. Friedl, O'Reilly and Associates, 2002.