提交 e3ab1100 编写于 作者: S sherman

6817475: named-capturing group name started with digit causes PSE exception

Summary: Need accept the digit as the first char of the group name
Reviewed-by: alanb
上级 8c0acbf2
......@@ -2567,7 +2567,8 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
break;
case '<': // (?<xxx) look behind
ch = read();
if (Character.isLetter(ch)) { // named captured group
if (ASCII.isLower(ch) || ASCII.isUpper(ch) || ASCII.isDigit(ch)) {
// named captured group
String name = groupname(ch);
if (namedGroups().containsKey(name))
throw error("Named capturing group <" + name
......
......@@ -3389,6 +3389,11 @@ public class RegExTest {
"gname",
"yyy");
check(Pattern.compile("x+(?<8gname>y+)z+"),
"xxxyyyzzz",
"8gname",
"yyy");
//backref
Pattern pattern = Pattern.compile("(a*)bc\\1");
check(pattern, "zzzaabcazzz", true); // found "abca"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册