Negation of a regular expression in a Pattern

Olivier Cailloux olivier.cailloux at gmail.com
Sun Aug 11 09:42:59 UTC 2024


Dear list,

The Pattern Javadoc does not specify whether “Any character” includes
line terminators in “Any character except a, b, or c (negation)”
([^abc]) or “Any character except one in the Greek block (negation)”
(\P{InGreek}), or whether it depends on DOTALL or MULTILINE being set.

As a result, it seems to me impossible from the doc to deduce, for
example, whether the Pattern "[^a]" will match a line terminator
(spoiler alert: it does). This discussion illustrates the confusion.

Would an addition to the doc be considered?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240811/de417ae1/attachment.htm>


More information about the core-libs-dev mailing list