IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Regexes
editRegexes
editRegular expression constants are directly supported. To ensure fast performance, this is the only mechanism for creating patterns. Regular expressions are always constants and compiled efficiently a single time.
Pattern p = /[aeiou]/
Pattern flags
editYou can define flags on patterns in Painless by adding characters after the
trailing /
like /foo/i
or /foo \w #comment/iUx
. Painless exposes all of
the flags from Java’s
Pattern class using these characters:
Character | Java Constant | Example |
---|---|---|
|
CANON_EQ |
|
|
CASE_INSENSITIVE |
|
|
LITERAL |
|
|
MULTILINE |
|
|
DOTALL (aka single line) |
|
|
UNICODE_CHARACTER_CLASS |
|
|
UNICODE_CASE |
|
|
COMMENTS (aka extended) |
|