src/share/classes/java/util/regex/Pattern.java
Print this page
*** 482,492 ****
*
* <a name="groupname">
* <h5> Group name </h5>
* <p>A capturing group can also be assigned a "name", a <tt>named-capturing group</tt>,
* and then be back-referenced later by the "name". Group names are composed of
! * the following characters:
*
* <ul>
* <li> The uppercase letters <tt>'A'</tt> through <tt>'Z'</tt>
* (<tt>'\u0041'</tt> through <tt>'\u005a'</tt>),
* <li> The lowercase letters <tt>'a'</tt> through <tt>'z'</tt>
--- 482,492 ----
*
* <a name="groupname">
* <h5> Group name </h5>
* <p>A capturing group can also be assigned a "name", a <tt>named-capturing group</tt>,
* and then be back-referenced later by the "name". Group names are composed of
! * the following characters. The first character must be a <tt>letter</tt>.
*
* <ul>
* <li> The uppercase letters <tt>'A'</tt> through <tt>'Z'</tt>
* (<tt>'\u0041'</tt> through <tt>'\u005a'</tt>),
* <li> The lowercase letters <tt>'a'</tt> through <tt>'z'</tt>
*** 2565,2575 ****
head.next = expr(tail);
head = tail = new Ques(head, INDEPENDENT);
break;
case '<': // (?<xxx) look behind
ch = read();
! 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
+ "> is already defined");
--- 2565,2575 ----
head.next = expr(tail);
head = tail = new Ques(head, INDEPENDENT);
break;
case '<': // (?<xxx) look behind
ch = read();
! if (ASCII.isLower(ch) || ASCII.isUpper(ch)) {
// named captured group
String name = groupname(ch);
if (namedGroups().containsKey(name))
throw error("Named capturing group <" + name
+ "> is already defined");