mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8199594: Add doc describing how (?x) ignores spaces in character classes
Reviewed-by: darcy, naoto, iris, lancea, bpb
This commit is contained in:
parent
4ed548b3ee
commit
a1c0a6aafb
1 changed files with 11 additions and 1 deletions
|
@ -755,6 +755,14 @@ import jdk.internal.util.ArraysSupport;
|
|||
* within a group; in the latter case, flags are restored at the end of the
|
||||
* group just as in Perl. </p></li>
|
||||
*
|
||||
* <li><p><i>Free-spacing mode</i> in Perl (called <i>comments
|
||||
* mode</i> in this class) denoted by {@code (?x)} in the regular
|
||||
* expression (or by the {@link Pattern#COMMENTS} flag when compiling
|
||||
* the expression) will not ignore whitespace inside of character classes. In
|
||||
* this class, whitespace inside of character classes must be escaped to be
|
||||
* considered as part of the regular expression when in comments mode.
|
||||
* </p></li>
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
|
@ -816,7 +824,9 @@ public final class Pattern
|
|||
* Permits whitespace and comments in pattern.
|
||||
*
|
||||
* <p> In this mode, whitespace is ignored, and embedded comments starting
|
||||
* with {@code #} are ignored until the end of a line.
|
||||
* with {@code #} are ignored until the end of a line. Comments mode ignores
|
||||
* whitespace within a character class contained in a pattern string. Such
|
||||
* whitespace must be escaped in order to be considered significant. </p>
|
||||
*
|
||||
* <p> Comments mode can also be enabled via the embedded flag
|
||||
* expression {@code (?x)}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue