-
CSR
-
Resolution: Approved
-
P4
-
None
-
minimal
-
No compatibility impact; spec is updated to match the implementation.
-
Java API
-
SE
Summary
The specification for the class java.util.regex.Pattern needs to be updated to state that the embedded flag 'U' can be turned on or off for non-capturing groups.
Problem
Javadoc for the class java.util.regex.Pattern specifies that these special constructs are allowed:
(?idmsuxU-idmsuxU) Nothing, but turns match flags i d m s u x U on - off
(?idmsux-idmsux:X) X, as a non-capturing group with the given flags i d m s u x on - off
In the second case, the flag 'U' is not listed as an allowed option. In fact, this flag is recognized by the parser and can be turned on/off for non-capturing groups.
Solution
The spec needs to be updated to list the flag 'U' among other options.
Specification
The specification will be modified in the following way:
- * <tr><th style="vertical-align:top; font-weight:normal" id="non_capture_group_flags"><code>(?idmsux-idmsux:</code><i>X</i>{@code )} </th>
+ * <tr><th style="vertical-align:top; font-weight:normal" id="non_capture_group_flags"><code>(?idmsuxU-idmsuxU:</code><i>X</i>{@code )} </th>
* <td headers="matches special non_capture_group_flags"><i>X</i>, as a <a href="#cg">non-capturing group</a> with the
* given flags <a href="#CASE_INSENSITIVE">i</a> <a href="#UNIX_LINES">d</a>
* <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a> <a href="#UNICODE_CASE">u</a >
- * <a href="#COMMENTS">x</a> on - off</td></tr>
+ * <a href="#COMMENTS">x</a> <a href="#UNICODE_CHARACTER_CLASS">U</a> on - off</td></tr>
Webrev with the change: http://cr.openjdk.java.net/~igerasim/8224849/00/webrev/
- csr of
-
JDK-8224849 Flag (?U:...) is allowed for non-capturing groups
-
- Resolved
-