Details
-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b03
Description
Javadoc for java.util.regex.Pattern specifies that these special costructs 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.
Below is a testcase, which demonstrates that the flag U is indeed recognized:
----------
import java.util.regex.*;
public class U {
public static void main(String[] args) throws Throwable {
Pattern p = Pattern.compile("(?U:\\d)");
Matcher m = p.matcher("\uFF11");
System.out.println(p + " " + m.matches());
}
}
----------
Prints out:
(?U:\d) true
----------
The javadoc has to be updated accordingly.
(?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.
Below is a testcase, which demonstrates that the flag U is indeed recognized:
----------
import java.util.regex.*;
public class U {
public static void main(String[] args) throws Throwable {
Pattern p = Pattern.compile("(?U:\\d)");
Matcher m = p.matcher("\uFF11");
System.out.println(p + " " + m.matches());
}
}
----------
Prints out:
(?U:\d) true
----------
The javadoc has to be updated accordingly.
Attachments
Issue Links
- csr for
-
JDK-8226914 Flag (?U:...) is allowed for non-capturing groups
-
- Closed
-
- relates to
-
JDK-7039066 j.u.rgex does not match TR#18 RL1.4 Simple Word Boundaries and RL1.2 Properties
-
- Closed
-
- links to