< prev index next >

src/java.base/share/classes/java/util/regex/Pattern.java

Print this page

        

*** 86,129 **** * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="characters">Characters</th></tr> * * <tr><td valign="top" headers="construct characters"><i>x</i></td> * <td headers="matches">The character <i>x</i></td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\\</tt></td> * <td headers="matches">The backslash character</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\0</tt><i>n</i></td> ! * <td headers="matches">The character with octal value <tt>0</tt><i>n</i> ! * (0&nbsp;<tt>&lt;=</tt>&nbsp;<i>n</i>&nbsp;<tt>&lt;=</tt>&nbsp;7)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\0</tt><i>nn</i></td> ! * <td headers="matches">The character with octal value <tt>0</tt><i>nn</i> ! * (0&nbsp;<tt>&lt;=</tt>&nbsp;<i>n</i>&nbsp;<tt>&lt;=</tt>&nbsp;7)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\0</tt><i>mnn</i></td> ! * <td headers="matches">The character with octal value <tt>0</tt><i>mnn</i> ! * (0&nbsp;<tt>&lt;=</tt>&nbsp;<i>m</i>&nbsp;<tt>&lt;=</tt>&nbsp;3, ! * 0&nbsp;<tt>&lt;=</tt>&nbsp;<i>n</i>&nbsp;<tt>&lt;=</tt>&nbsp;7)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\x</tt><i>hh</i></td> ! * <td headers="matches">The character with hexadecimal&nbsp;value&nbsp;<tt>0x</tt><i>hh</i></td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\u</tt><i>hhhh</i></td> ! * <td headers="matches">The character with hexadecimal&nbsp;value&nbsp;<tt>0x</tt><i>hhhh</i></td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\x</tt><i>{h...h}</i></td> ! * <td headers="matches">The character with hexadecimal&nbsp;value&nbsp;<tt>0x</tt><i>h...h</i> * ({@link java.lang.Character#MIN_CODE_POINT Character.MIN_CODE_POINT} ! * &nbsp;&lt;=&nbsp;<tt>0x</tt><i>h...h</i>&nbsp;&lt;=&nbsp; * {@link java.lang.Character#MAX_CODE_POINT Character.MAX_CODE_POINT})</td></tr> ! * <tr><td valign="top" headers="matches"><tt>\t</tt></td> ! * <td headers="matches">The tab character (<tt>'\u0009'</tt>)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\n</tt></td> ! * <td headers="matches">The newline (line feed) character (<tt>'\u000A'</tt>)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\r</tt></td> ! * <td headers="matches">The carriage-return character (<tt>'\u000D'</tt>)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\f</tt></td> ! * <td headers="matches">The form-feed character (<tt>'\u000C'</tt>)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\a</tt></td> ! * <td headers="matches">The alert (bell) character (<tt>'\u0007'</tt>)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\e</tt></td> ! * <td headers="matches">The escape character (<tt>'\u001B'</tt>)</td></tr> ! * <tr><td valign="top" headers="construct characters"><tt>\c</tt><i>x</i></td> * <td headers="matches">The control character corresponding to <i>x</i></td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="classes">Character classes</th></tr> * --- 86,129 ---- * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="characters">Characters</th></tr> * * <tr><td valign="top" headers="construct characters"><i>x</i></td> * <td headers="matches">The character <i>x</i></td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \\}</td> * <td headers="matches">The backslash character</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \0}<i>n</i></td> ! * <td headers="matches">The character with octal value {@code 0}<i>n</i> ! * (0&nbsp;{@code <=}&nbsp;<i>n</i>&nbsp;{@code <=}&nbsp;7)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \0}<i>nn</i></td> ! * <td headers="matches">The character with octal value {@code 0}<i>nn</i> ! * (0&nbsp;{@code <=}&nbsp;<i>n</i>&nbsp;{@code <=}&nbsp;7)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \0}<i>mnn</i></td> ! * <td headers="matches">The character with octal value {@code 0}<i>mnn</i> ! * (0&nbsp;{@code <=}&nbsp;<i>m</i>&nbsp;{@code <=}&nbsp;3, ! * 0&nbsp;{@code <=}&nbsp;<i>n</i>&nbsp;{@code <=}&nbsp;7)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \x}<i>hh</i></td> ! * <td headers="matches">The character with hexadecimal&nbsp;value&nbsp;{@code 0x}<i>hh</i></td></tr> ! * <tr><td valign="top" headers="construct characters"><code>\u</code><i>hhhh</i></td> ! * <td headers="matches">The character with hexadecimal&nbsp;value&nbsp;{@code 0x}<i>hhhh</i></td></tr> ! * <tr><td valign="top" headers="construct characters"><code>\x</code><i>{h...h}</i></td> ! * <td headers="matches">The character with hexadecimal&nbsp;value&nbsp;{@code 0x}<i>h...h</i> * ({@link java.lang.Character#MIN_CODE_POINT Character.MIN_CODE_POINT} ! * &nbsp;&lt;=&nbsp;{@code 0x}<i>h...h</i>&nbsp;&lt;=&nbsp; * {@link java.lang.Character#MAX_CODE_POINT Character.MAX_CODE_POINT})</td></tr> ! * <tr><td valign="top" headers="matches">{@code \t}</td> ! * <td headers="matches">The tab character (<code>'\u0009'</code>)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \n}</td> ! * <td headers="matches">The newline (line feed) character (<code>'\u000A'</code>)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \r}</td> ! * <td headers="matches">The carriage-return character (<code>'\u000D'</code>)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \f}</td> ! * <td headers="matches">The form-feed character (<code>'\u000C'</code>)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \a}</td> ! * <td headers="matches">The alert (bell) character (<code>'\u0007'</code>)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \e}</td> ! * <td headers="matches">The escape character (<code>'\u001B'</code>)</td></tr> ! * <tr><td valign="top" headers="construct characters">{@code \c}<i>x</i></td> * <td headers="matches">The control character corresponding to <i>x</i></td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="classes">Character classes</th></tr> *
*** 147,180 **** * and not {@code m} through {@code p}: {@code [a-lq-z]}(subtraction)</td></tr> * <tr><th>&nbsp;</th></tr> * * <tr align="left"><th colspan="2" id="predef">Predefined character classes</th></tr> * ! * <tr><td valign="top" headers="construct predef"><tt>.</tt></td> * <td headers="matches">Any character (may or may not match <a href="#lt">line terminators</a>)</td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\d</tt></td> ! * <td headers="matches">A digit: <tt>[0-9]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\D</tt></td> ! * <td headers="matches">A non-digit: <tt>[^0-9]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\h</tt></td> * <td headers="matches">A horizontal whitespace character: ! * <tt>[ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\H</tt></td> ! * <td headers="matches">A non-horizontal whitespace character: <tt>[^\h]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\s</tt></td> ! * <td headers="matches">A whitespace character: <tt>[ \t\n\x0B\f\r]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\S</tt></td> ! * <td headers="matches">A non-whitespace character: <tt>[^\s]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\v</tt></td> ! * <td headers="matches">A vertical whitespace character: <tt>[\n\x0B\f\r\x85\u2028\u2029]</tt> * </td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\V</tt></td> ! * <td headers="matches">A non-vertical whitespace character: <tt>[^\v]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\w</tt></td> ! * <td headers="matches">A word character: <tt>[a-zA-Z_0-9]</tt></td></tr> ! * <tr><td valign="top" headers="construct predef"><tt>\W</tt></td> ! * <td headers="matches">A non-word character: <tt>[^\w]</tt></td></tr> * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="posix"><b>POSIX character classes (US-ASCII only)</b></th></tr> * * <tr><td valign="top" headers="construct posix">{@code \p{Lower}}</td> * <td headers="matches">A lower-case alphabetic character: {@code [a-z]}</td></tr> --- 147,180 ---- * and not {@code m} through {@code p}: {@code [a-lq-z]}(subtraction)</td></tr> * <tr><th>&nbsp;</th></tr> * * <tr align="left"><th colspan="2" id="predef">Predefined character classes</th></tr> * ! * <tr><td valign="top" headers="construct predef">{@code .}</td> * <td headers="matches">Any character (may or may not match <a href="#lt">line terminators</a>)</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \d}</td> ! * <td headers="matches">A digit: {@code [0-9]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \D}</td> ! * <td headers="matches">A non-digit: {@code [^0-9]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \h}</td> * <td headers="matches">A horizontal whitespace character: ! * <code>[ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]</code></td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \H}</td> ! * <td headers="matches">A non-horizontal whitespace character: {@code [^\h]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \s}</td> ! * <td headers="matches">A whitespace character: {@code [ \t\n\x0B\f\r]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \S}</td> ! * <td headers="matches">A non-whitespace character: {@code [^\s]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \v}</td> ! * <td headers="matches">A vertical whitespace character: <code>[\n\x0B\f\r\x85\u2028\u2029]</code> * </td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \V}</td> ! * <td headers="matches">A non-vertical whitespace character: {@code [^\v]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \w}</td> ! * <td headers="matches">A word character: {@code [a-zA-Z_0-9]}</td></tr> ! * <tr><td valign="top" headers="construct predef">{@code \W}</td> ! * <td headers="matches">A non-word character: {@code [^\w]}</td></tr> * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="posix"><b>POSIX character classes (US-ASCII only)</b></th></tr> * * <tr><td valign="top" headers="construct posix">{@code \p{Lower}}</td> * <td headers="matches">A lower-case alphabetic character: {@code [a-z]}</td></tr>
*** 206,222 **** * <td headers="matches">A whitespace character: {@code [ \t\n\x0B\f\r]}</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2">java.lang.Character classes (simple <a href="#jcc">java character type</a>)</th></tr> * ! * <tr><td valign="top"><tt>\p{javaLowerCase}</tt></td> * <td>Equivalent to java.lang.Character.isLowerCase()</td></tr> ! * <tr><td valign="top"><tt>\p{javaUpperCase}</tt></td> * <td>Equivalent to java.lang.Character.isUpperCase()</td></tr> ! * <tr><td valign="top"><tt>\p{javaWhitespace}</tt></td> * <td>Equivalent to java.lang.Character.isWhitespace()</td></tr> ! * <tr><td valign="top"><tt>\p{javaMirrored}</tt></td> * <td>Equivalent to java.lang.Character.isMirrored()</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="unicode">Classes for Unicode scripts, blocks, categories and binary properties</th></tr> * <tr><td valign="top" headers="construct unicode">{@code \p{IsLatin}}</td> --- 206,222 ---- * <td headers="matches">A whitespace character: {@code [ \t\n\x0B\f\r]}</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2">java.lang.Character classes (simple <a href="#jcc">java character type</a>)</th></tr> * ! * <tr><td valign="top">{@code \p{javaLowerCase}}</td> * <td>Equivalent to java.lang.Character.isLowerCase()</td></tr> ! * <tr><td valign="top">{@code \p{javaUpperCase}}</td> * <td>Equivalent to java.lang.Character.isUpperCase()</td></tr> ! * <tr><td valign="top">{@code \p{javaWhitespace}}</td> * <td>Equivalent to java.lang.Character.isWhitespace()</td></tr> ! * <tr><td valign="top">{@code \p{javaMirrored}}</td> * <td>Equivalent to java.lang.Character.isMirrored()</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="unicode">Classes for Unicode scripts, blocks, categories and binary properties</th></tr> * <tr><td valign="top" headers="construct unicode">{@code \p{IsLatin}}</td>
*** 235,388 **** * <td headers="matches">Any letter except an uppercase letter (subtraction)</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="bounds">Boundary matchers</th></tr> * ! * <tr><td valign="top" headers="construct bounds"><tt>^</tt></td> * <td headers="matches">The beginning of a line</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>$</tt></td> * <td headers="matches">The end of a line</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>\b</tt></td> * <td headers="matches">A word boundary</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>\B</tt></td> * <td headers="matches">A non-word boundary</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>\A</tt></td> * <td headers="matches">The beginning of the input</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>\G</tt></td> * <td headers="matches">The end of the previous match</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>\Z</tt></td> * <td headers="matches">The end of the input but for the final * <a href="#lt">terminator</a>, if&nbsp;any</td></tr> ! * <tr><td valign="top" headers="construct bounds"><tt>\z</tt></td> * <td headers="matches">The end of the input</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="lineending">Linebreak matcher</th></tr> ! * <tr><td valign="top" headers="construct lineending"><tt>\R</tt></td> * <td headers="matches">Any Unicode linebreak sequence, is equivalent to ! * <tt>\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029] ! * </tt></td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="greedy">Greedy quantifiers</th></tr> * ! * <tr><td valign="top" headers="construct greedy"><i>X</i><tt>?</tt></td> * <td headers="matches"><i>X</i>, once or not at all</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><tt>*</tt></td> * <td headers="matches"><i>X</i>, zero or more times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><tt>+</tt></td> * <td headers="matches"><i>X</i>, one or more times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><tt>{</tt><i>n</i><tt>}</tt></td> * <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><tt>{</tt><i>n</i><tt>,}</tt></td> * <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}</tt></td> * <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="reluc">Reluctant quantifiers</th></tr> * ! * <tr><td valign="top" headers="construct reluc"><i>X</i><tt>??</tt></td> * <td headers="matches"><i>X</i>, once or not at all</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><tt>*?</tt></td> * <td headers="matches"><i>X</i>, zero or more times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><tt>+?</tt></td> * <td headers="matches"><i>X</i>, one or more times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><tt>{</tt><i>n</i><tt>}?</tt></td> * <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><tt>{</tt><i>n</i><tt>,}?</tt></td> * <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}?</tt></td> * <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="poss">Possessive quantifiers</th></tr> * ! * <tr><td valign="top" headers="construct poss"><i>X</i><tt>?+</tt></td> * <td headers="matches"><i>X</i>, once or not at all</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><tt>*+</tt></td> * <td headers="matches"><i>X</i>, zero or more times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><tt>++</tt></td> * <td headers="matches"><i>X</i>, one or more times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><tt>{</tt><i>n</i><tt>}+</tt></td> * <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><tt>{</tt><i>n</i><tt>,}+</tt></td> * <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}+</tt></td> * <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="logical">Logical operators</th></tr> * * <tr><td valign="top" headers="construct logical"><i>XY</i></td> * <td headers="matches"><i>X</i> followed by <i>Y</i></td></tr> ! * <tr><td valign="top" headers="construct logical"><i>X</i><tt>|</tt><i>Y</i></td> * <td headers="matches">Either <i>X</i> or <i>Y</i></td></tr> ! * <tr><td valign="top" headers="construct logical"><tt>(</tt><i>X</i><tt>)</tt></td> * <td headers="matches">X, as a <a href="#cg">capturing group</a></td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="backref">Back references</th></tr> * ! * <tr><td valign="bottom" headers="construct backref"><tt>\</tt><i>n</i></td> * <td valign="bottom" headers="matches">Whatever the <i>n</i><sup>th</sup> * <a href="#cg">capturing group</a> matched</td></tr> * ! * <tr><td valign="bottom" headers="construct backref"><tt>\</tt><i>k</i>&lt;<i>name</i>&gt;</td> * <td valign="bottom" headers="matches">Whatever the * <a href="#groupname">named-capturing group</a> "name" matched</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="quot">Quotation</th></tr> * ! * <tr><td valign="top" headers="construct quot"><tt>\</tt></td> * <td headers="matches">Nothing, but quotes the following character</td></tr> ! * <tr><td valign="top" headers="construct quot"><tt>\Q</tt></td> ! * <td headers="matches">Nothing, but quotes all characters until <tt>\E</tt></td></tr> ! * <tr><td valign="top" headers="construct quot"><tt>\E</tt></td> ! * <td headers="matches">Nothing, but ends quoting started by <tt>\Q</tt></td></tr> * <!-- Metachars: !$()*+.<>?[\]^{|} --> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="special">Special constructs (named-capturing and non-capturing)</th></tr> * ! * <tr><td valign="top" headers="construct special"><tt>(?&lt;<a href="#groupname">name</a>&gt;</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, as a named-capturing group</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?:</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, as a non-capturing group</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?idmsuxU-idmsuxU)&nbsp;</tt></td> * <td headers="matches">Nothing, but turns match 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> <a href="#UNICODE_CHARACTER_CLASS">U</a> * on - off</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?idmsux-idmsux:</tt><i>X</i><tt>)</tt>&nbsp;&nbsp;</td> * <td headers="matches"><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> ! * <tr><td valign="top" headers="construct special"><tt>(?=</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, via zero-width positive lookahead</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?!</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, via zero-width negative lookahead</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?&lt;=</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, via zero-width positive lookbehind</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?&lt;!</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, via zero-width negative lookbehind</td></tr> ! * <tr><td valign="top" headers="construct special"><tt>(?&gt;</tt><i>X</i><tt>)</tt></td> * <td headers="matches"><i>X</i>, as an independent, non-capturing group</td></tr> * * </table> * * <hr> * * * <h3><a name="bs">Backslashes, escapes, and quoting</a></h3> * ! * <p> The backslash character (<tt>'\'</tt>) serves to introduce escaped * constructs, as defined in the table above, as well as to quote characters * that otherwise would be interpreted as unescaped constructs. Thus the ! * expression <tt>\\</tt> matches a single backslash and <tt>\{</tt> matches a * left brace. * * <p> It is an error to use a backslash prior to any alphabetic character that * does not denote an escaped construct; these are reserved for future * extensions to the regular-expression language. A backslash may be used --- 235,388 ---- * <td headers="matches">Any letter except an uppercase letter (subtraction)</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="bounds">Boundary matchers</th></tr> * ! * <tr><td valign="top" headers="construct bounds">{@code ^}</td> * <td headers="matches">The beginning of a line</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code $}</td> * <td headers="matches">The end of a line</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code \b}</td> * <td headers="matches">A word boundary</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code \B}</td> * <td headers="matches">A non-word boundary</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code \A}</td> * <td headers="matches">The beginning of the input</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code \G}</td> * <td headers="matches">The end of the previous match</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code \Z}</td> * <td headers="matches">The end of the input but for the final * <a href="#lt">terminator</a>, if&nbsp;any</td></tr> ! * <tr><td valign="top" headers="construct bounds">{@code \z}</td> * <td headers="matches">The end of the input</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="lineending">Linebreak matcher</th></tr> ! * <tr><td valign="top" headers="construct lineending">{@code \R}</td> * <td headers="matches">Any Unicode linebreak sequence, is equivalent to ! * <code>\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029] ! * </code></td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="greedy">Greedy quantifiers</th></tr> * ! * <tr><td valign="top" headers="construct greedy"><i>X</i>{@code ?}</td> * <td headers="matches"><i>X</i>, once or not at all</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i>{@code *}</td> * <td headers="matches"><i>X</i>, zero or more times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i>{@code +}</td> * <td headers="matches"><i>X</i>, one or more times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><code>{</code><i>n</i><code>}</code></td> * <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><code>{</code><i>n</i>{@code ,}}</td> * <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct greedy"><i>X</i><code>{</code><i>n</i>{@code ,}<i>m</i><code>}</code></td> * <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="reluc">Reluctant quantifiers</th></tr> * ! * <tr><td valign="top" headers="construct reluc"><i>X</i>{@code ??}</td> * <td headers="matches"><i>X</i>, once or not at all</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i>{@code *?}</td> * <td headers="matches"><i>X</i>, zero or more times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i>{@code +?}</td> * <td headers="matches"><i>X</i>, one or more times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><code>{</code><i>n</i><code>}?</code></td> * <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><code>{</code><i>n</i><code>,}?</code></td> * <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct reluc"><i>X</i><code>{</code><i>n</i>{@code ,}<i>m</i><code>}?</code></td> * <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="poss">Possessive quantifiers</th></tr> * ! * <tr><td valign="top" headers="construct poss"><i>X</i>{@code ?+}</td> * <td headers="matches"><i>X</i>, once or not at all</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i>{@code *+}</td> * <td headers="matches"><i>X</i>, zero or more times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i>{@code ++}</td> * <td headers="matches"><i>X</i>, one or more times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><code>{</code><i>n</i><code>}+</code></td> * <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><code>{</code><i>n</i><code>,}+</code></td> * <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr> ! * <tr><td valign="top" headers="construct poss"><i>X</i><code>{</code><i>n</i>{@code ,}<i>m</i><code>}+</code></td> * <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="logical">Logical operators</th></tr> * * <tr><td valign="top" headers="construct logical"><i>XY</i></td> * <td headers="matches"><i>X</i> followed by <i>Y</i></td></tr> ! * <tr><td valign="top" headers="construct logical"><i>X</i>{@code |}<i>Y</i></td> * <td headers="matches">Either <i>X</i> or <i>Y</i></td></tr> ! * <tr><td valign="top" headers="construct logical">{@code (}<i>X</i>{@code )}</td> * <td headers="matches">X, as a <a href="#cg">capturing group</a></td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="backref">Back references</th></tr> * ! * <tr><td valign="bottom" headers="construct backref">{@code \}<i>n</i></td> * <td valign="bottom" headers="matches">Whatever the <i>n</i><sup>th</sup> * <a href="#cg">capturing group</a> matched</td></tr> * ! * <tr><td valign="bottom" headers="construct backref">{@code \}<i>k</i>&lt;<i>name</i>&gt;</td> * <td valign="bottom" headers="matches">Whatever the * <a href="#groupname">named-capturing group</a> "name" matched</td></tr> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="quot">Quotation</th></tr> * ! * <tr><td valign="top" headers="construct quot">{@code \}</td> * <td headers="matches">Nothing, but quotes the following character</td></tr> ! * <tr><td valign="top" headers="construct quot">{@code \Q}</td> ! * <td headers="matches">Nothing, but quotes all characters until {@code \E}</td></tr> ! * <tr><td valign="top" headers="construct quot">{@code \E}</td> ! * <td headers="matches">Nothing, but ends quoting started by {@code \Q}</td></tr> * <!-- Metachars: !$()*+.<>?[\]^{|} --> * * <tr><th>&nbsp;</th></tr> * <tr align="left"><th colspan="2" id="special">Special constructs (named-capturing and non-capturing)</th></tr> * ! * <tr><td valign="top" headers="construct special"><code>(?&lt;<a href="#groupname">name</a>&gt;</code><i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, as a named-capturing group</td></tr> ! * <tr><td valign="top" headers="construct special">{@code (?:}<i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, as a non-capturing group</td></tr> ! * <tr><td valign="top" headers="construct special"><code>(?idmsuxU-idmsuxU)&nbsp;</code></td> * <td headers="matches">Nothing, but turns match 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> <a href="#UNICODE_CHARACTER_CLASS">U</a> * on - off</td></tr> ! * <tr><td valign="top" headers="construct special"><code>(?idmsux-idmsux:</code><i>X</i>{@code )}&nbsp;&nbsp;</td> * <td headers="matches"><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> ! * <tr><td valign="top" headers="construct special">{@code (?=}<i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, via zero-width positive lookahead</td></tr> ! * <tr><td valign="top" headers="construct special">{@code (?!}<i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, via zero-width negative lookahead</td></tr> ! * <tr><td valign="top" headers="construct special">{@code (?<=}<i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, via zero-width positive lookbehind</td></tr> ! * <tr><td valign="top" headers="construct special">{@code (?<!}<i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, via zero-width negative lookbehind</td></tr> ! * <tr><td valign="top" headers="construct special">{@code (?>}<i>X</i>{@code )}</td> * <td headers="matches"><i>X</i>, as an independent, non-capturing group</td></tr> * * </table> * * <hr> * * * <h3><a name="bs">Backslashes, escapes, and quoting</a></h3> * ! * <p> The backslash character ({@code '\'}) serves to introduce escaped * constructs, as defined in the table above, as well as to quote characters * that otherwise would be interpreted as unescaped constructs. Thus the ! * expression {@code \\} matches a single backslash and <code>\{</code> matches a * left brace. * * <p> It is an error to use a backslash prior to any alphabetic character that * does not denote an escaped construct; these are reserved for future * extensions to the regular-expression language. A backslash may be used
*** 394,415 **** * <cite>The Java&trade; Language Specification</cite> * as either Unicode escapes (section 3.3) or other character escapes (section 3.10.6) * It is therefore necessary to double backslashes in string * literals that represent regular expressions to protect them from * interpretation by the Java bytecode compiler. The string literal ! * <tt>"\b"</tt>, for example, matches a single backspace character when ! * interpreted as a regular expression, while <tt>"\\b"</tt> matches a ! * word boundary. The string literal <tt>"\(hello\)"</tt> is illegal * and leads to a compile-time error; in order to match the string ! * <tt>(hello)</tt> the string literal <tt>"\\(hello\\)"</tt> * must be used. * * <h3><a name="cc">Character Classes</a></h3> * * <p> Character classes may appear within other character classes, and * may be composed by the union operator (implicit) and the intersection ! * operator (<tt>&amp;&amp;</tt>). * The union operator denotes a class that contains every character that is * in at least one of its operand classes. The intersection operator * denotes a class that contains every character that is in both of its * operand classes. * --- 394,415 ---- * <cite>The Java&trade; Language Specification</cite> * as either Unicode escapes (section 3.3) or other character escapes (section 3.10.6) * It is therefore necessary to double backslashes in string * literals that represent regular expressions to protect them from * interpretation by the Java bytecode compiler. The string literal ! * <code>"\b"</code>, for example, matches a single backspace character when ! * interpreted as a regular expression, while {@code "\\b"} matches a ! * word boundary. The string literal {@code "\(hello\)"} is illegal * and leads to a compile-time error; in order to match the string ! * {@code (hello)} the string literal {@code "\\(hello\\)"} * must be used. * * <h3><a name="cc">Character Classes</a></h3> * * <p> Character classes may appear within other character classes, and * may be composed by the union operator (implicit) and the intersection ! * operator ({@code &&}). * The union operator denotes a class that contains every character that is * in at least one of its operand classes. The intersection operator * denotes a class that contains every character that is in both of its * operand classes. *
*** 418,584 **** * * <blockquote><table border="0" cellpadding="1" cellspacing="0" * summary="Precedence of character class operators."> * <tr><th>1&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Literal escape&nbsp;&nbsp;&nbsp;&nbsp;</td> ! * <td><tt>\x</tt></td></tr> * <tr><th>2&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Grouping</td> ! * <td><tt>[...]</tt></td></tr> * <tr><th>3&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Range</td> ! * <td><tt>a-z</tt></td></tr> * <tr><th>4&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Union</td> ! * <td><tt>[a-e][i-u]</tt></td></tr> * <tr><th>5&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Intersection</td> * <td>{@code [a-z&&[aeiou]]}</td></tr> * </table></blockquote> * * <p> Note that a different set of metacharacters are in effect inside * a character class than outside a character class. For instance, the ! * regular expression <tt>.</tt> loses its special meaning inside a ! * character class, while the expression <tt>-</tt> becomes a range * forming metacharacter. * * <h3><a name="lt">Line terminators</a></h3> * * <p> A <i>line terminator</i> is a one- or two-character sequence that marks * the end of a line of the input character sequence. The following are * recognized as line terminators: * * <ul> * ! * <li> A newline (line feed) character&nbsp;(<tt>'\n'</tt>), * * <li> A carriage-return character followed immediately by a newline ! * character&nbsp;(<tt>"\r\n"</tt>), * ! * <li> A standalone carriage-return character&nbsp;(<tt>'\r'</tt>), * ! * <li> A next-line character&nbsp;(<tt>'\u0085'</tt>), * ! * <li> A line-separator character&nbsp;(<tt>'\u2028'</tt>), or * ! * <li> A paragraph-separator character&nbsp;(<tt>'\u2029</tt>). * * </ul> * <p>If {@link #UNIX_LINES} mode is activated, then the only line terminators * recognized are newline characters. * ! * <p> The regular expression <tt>.</tt> matches any character except a line * terminator unless the {@link #DOTALL} flag is specified. * ! * <p> By default, the regular expressions <tt>^</tt> and <tt>$</tt> ignore * line terminators and only match at the beginning and the end, respectively, * of the entire input sequence. If {@link #MULTILINE} mode is activated then ! * <tt>^</tt> matches at the beginning of input and after any line terminator ! * except at the end of input. When in {@link #MULTILINE} mode <tt>$</tt> * matches just before a line terminator or the end of the input sequence. * * <h3><a name="cg">Groups and capturing</a></h3> * * <h4><a name="gnumber">Group number</a></h4> * <p> Capturing groups are numbered by counting their opening parentheses from ! * left to right. In the expression <tt>((A)(B(C)))</tt>, for example, there * are four such groups: </p> * * <blockquote><table cellpadding=1 cellspacing=0 summary="Capturing group numberings"> * <tr><th>1&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td><tt>((A)(B(C)))</tt></td></tr> * <tr><th>2&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td><tt>(A)</tt></td></tr> * <tr><th>3&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td><tt>(B(C))</tt></td></tr> * <tr><th>4&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td><tt>(C)</tt></td></tr> * </table></blockquote> * * <p> Group zero always stands for the entire expression. * * <p> Capturing groups are so named because, during a match, each subsequence * of the input sequence that matches such a group is saved. The captured * subsequence may be used later in the expression, via a back reference, and * may also be retrieved from the matcher once the match operation is complete. * * <h4><a name="groupname">Group name</a></h4> ! * <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>&nbsp;through&nbsp;<tt>'\u005a'</tt>), ! * <li> The lowercase letters <tt>'a'</tt> through <tt>'z'</tt> ! * (<tt>'\u0061'</tt>&nbsp;through&nbsp;<tt>'\u007a'</tt>), ! * <li> The digits <tt>'0'</tt> through <tt>'9'</tt> ! * (<tt>'\u0030'</tt>&nbsp;through&nbsp;<tt>'\u0039'</tt>), * </ul> * ! * <p> A <tt>named-capturing group</tt> is still numbered as described in * <a href="#gnumber">Group number</a>. * * <p> The captured input associated with a group is always the subsequence * that the group most recently matched. If a group is evaluated a second time * because of quantification then its previously-captured value, if any, will * be retained if the second evaluation fails. Matching the string ! * <tt>"aba"</tt> against the expression <tt>(a(b)?)+</tt>, for example, leaves ! * group two set to <tt>"b"</tt>. All captured input is discarded at the * beginning of each match. * ! * <p> Groups beginning with <tt>(?</tt> are either pure, <i>non-capturing</i> groups * that do not capture text and do not count towards the group total, or * <i>named-capturing</i> group. * * <h3> Unicode support </h3> * * <p> This class is in conformance with Level 1 of <a * href="http://www.unicode.org/reports/tr18/"><i>Unicode Technical * Standard #18: Unicode Regular Expression</i></a>, plus RL2.1 * Canonical Equivalents. * <p> ! * <b>Unicode escape sequences</b> such as <tt>\u2014</tt> in Java source code * are processed as described in section 3.3 of * <cite>The Java&trade; Language Specification</cite>. * Such escape sequences are also implemented directly by the regular-expression * parser so that Unicode escapes can be used in expressions that are read from ! * files or from the keyboard. Thus the strings <tt>"\u2014"</tt> and ! * <tt>"\\u2014"</tt>, while not equal, compile into the same pattern, which ! * matches the character with hexadecimal value <tt>0x2014</tt>. * <p> * A Unicode character can also be represented in a regular-expression by * using its <b>Hex notation</b>(hexadecimal code point value) directly as described in construct ! * <tt>\x{...}</tt>, for example a supplementary character U+2011F ! * can be specified as <tt>\x{2011F}</tt>, instead of two consecutive * Unicode escape sequences of the surrogate pair ! * <tt>\uD840</tt><tt>\uDD1F</tt>. * <p> * Unicode scripts, blocks, categories and binary properties are written with ! * the <tt>\p</tt> and <tt>\P</tt> constructs as in Perl. ! * <tt>\p{</tt><i>prop</i><tt>}</tt> matches if ! * the input has the property <i>prop</i>, while <tt>\P{</tt><i>prop</i><tt>}</tt> * does not match if the input has that property. * <p> * Scripts, blocks, categories and binary properties can be used both inside * and outside of a character class. * * <p> * <b><a name="usc">Scripts</a></b> are specified either with the prefix {@code Is}, as in * {@code IsHiragana}, or by using the {@code script} keyword (or its short * form {@code sc}) as in {@code script=Hiragana} or {@code sc=Hiragana}. * <p> ! * The script names supported by <code>Pattern</code> are the valid script names * accepted and defined by * {@link java.lang.Character.UnicodeScript#forName(String) UnicodeScript.forName}. * * <p> * <b><a name="ubc">Blocks</a></b> are specified with the prefix {@code In}, as in * {@code InMongolian}, or by using the keyword {@code block} (or its short * form {@code blk}) as in {@code block=Mongolian} or {@code blk=Mongolian}. * <p> ! * The block names supported by <code>Pattern</code> are the valid block names * accepted and defined by * {@link java.lang.Character.UnicodeBlock#forName(String) UnicodeBlock.forName}. * <p> * * <b><a name="ucc">Categories</a></b> may be specified with the optional prefix {@code Is}: --- 418,584 ---- * * <blockquote><table border="0" cellpadding="1" cellspacing="0" * summary="Precedence of character class operators."> * <tr><th>1&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Literal escape&nbsp;&nbsp;&nbsp;&nbsp;</td> ! * <td>{@code \x}</td></tr> * <tr><th>2&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Grouping</td> ! * <td>{@code [...]}</td></tr> * <tr><th>3&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Range</td> ! * <td>{@code a-z}</td></tr> * <tr><th>4&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Union</td> ! * <td>{@code [a-e][i-u]}</td></tr> * <tr><th>5&nbsp;&nbsp;&nbsp;&nbsp;</th> * <td>Intersection</td> * <td>{@code [a-z&&[aeiou]]}</td></tr> * </table></blockquote> * * <p> Note that a different set of metacharacters are in effect inside * a character class than outside a character class. For instance, the ! * regular expression {@code .} loses its special meaning inside a ! * character class, while the expression {@code -} becomes a range * forming metacharacter. * * <h3><a name="lt">Line terminators</a></h3> * * <p> A <i>line terminator</i> is a one- or two-character sequence that marks * the end of a line of the input character sequence. The following are * recognized as line terminators: * * <ul> * ! * <li> A newline (line feed) character&nbsp;({@code '\n'}), * * <li> A carriage-return character followed immediately by a newline ! * character&nbsp;({@code "\r\n"}), * ! * <li> A standalone carriage-return character&nbsp;({@code '\r'}), * ! * <li> A next-line character&nbsp;(<code>'\u0085'</code>), * ! * <li> A line-separator character&nbsp;(<code>'\u2028'</code>), or * ! * <li> A paragraph-separator character&nbsp;(<code>'\u2029</code>). * * </ul> * <p>If {@link #UNIX_LINES} mode is activated, then the only line terminators * recognized are newline characters. * ! * <p> The regular expression {@code .} matches any character except a line * terminator unless the {@link #DOTALL} flag is specified. * ! * <p> By default, the regular expressions {@code ^} and {@code $} ignore * line terminators and only match at the beginning and the end, respectively, * of the entire input sequence. If {@link #MULTILINE} mode is activated then ! * {@code ^} matches at the beginning of input and after any line terminator ! * except at the end of input. When in {@link #MULTILINE} mode {@code $} * matches just before a line terminator or the end of the input sequence. * * <h3><a name="cg">Groups and capturing</a></h3> * * <h4><a name="gnumber">Group number</a></h4> * <p> Capturing groups are numbered by counting their opening parentheses from ! * left to right. In the expression {@code ((A)(B(C)))}, for example, there * are four such groups: </p> * * <blockquote><table cellpadding=1 cellspacing=0 summary="Capturing group numberings"> * <tr><th>1&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td>{@code ((A)(B(C)))}</td></tr> * <tr><th>2&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td>{@code (A)}</td></tr> * <tr><th>3&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td>{@code (B(C))}</td></tr> * <tr><th>4&nbsp;&nbsp;&nbsp;&nbsp;</th> ! * <td>{@code (C)}</td></tr> * </table></blockquote> * * <p> Group zero always stands for the entire expression. * * <p> Capturing groups are so named because, during a match, each subsequence * of the input sequence that matches such a group is saved. The captured * subsequence may be used later in the expression, via a back reference, and * may also be retrieved from the matcher once the match operation is complete. * * <h4><a name="groupname">Group name</a></h4> ! * <p>A capturing group can also be assigned a "name", a {@code named-capturing group}, * and then be back-referenced later by the "name". Group names are composed of ! * the following characters. The first character must be a {@code letter}. * * <ul> ! * <li> The uppercase letters {@code 'A'} through {@code 'Z'} ! * (<code>'\u0041'</code>&nbsp;through&nbsp;<code>'\u005a'</code>), ! * <li> The lowercase letters {@code 'a'} through {@code 'z'} ! * (<code>'\u0061'</code>&nbsp;through&nbsp;<code>'\u007a'</code>), ! * <li> The digits {@code '0'} through {@code '9'} ! * (<code>'\u0030'</code>&nbsp;through&nbsp;<code>'\u0039'</code>), * </ul> * ! * <p> A {@code named-capturing group} is still numbered as described in * <a href="#gnumber">Group number</a>. * * <p> The captured input associated with a group is always the subsequence * that the group most recently matched. If a group is evaluated a second time * because of quantification then its previously-captured value, if any, will * be retained if the second evaluation fails. Matching the string ! * {@code "aba"} against the expression {@code (a(b)?)+}, for example, leaves ! * group two set to {@code "b"}. All captured input is discarded at the * beginning of each match. * ! * <p> Groups beginning with {@code (?} are either pure, <i>non-capturing</i> groups * that do not capture text and do not count towards the group total, or * <i>named-capturing</i> group. * * <h3> Unicode support </h3> * * <p> This class is in conformance with Level 1 of <a * href="http://www.unicode.org/reports/tr18/"><i>Unicode Technical * Standard #18: Unicode Regular Expression</i></a>, plus RL2.1 * Canonical Equivalents. * <p> ! * <b>Unicode escape sequences</b> such as <code>\u2014</code> in Java source code * are processed as described in section 3.3 of * <cite>The Java&trade; Language Specification</cite>. * Such escape sequences are also implemented directly by the regular-expression * parser so that Unicode escapes can be used in expressions that are read from ! * files or from the keyboard. Thus the strings <code>"\u2014"</code> and ! * {@code "\\u2014"}, while not equal, compile into the same pattern, which ! * matches the character with hexadecimal value {@code 0x2014}. * <p> * A Unicode character can also be represented in a regular-expression by * using its <b>Hex notation</b>(hexadecimal code point value) directly as described in construct ! * <code>\x{...}</code>, for example a supplementary character U+2011F ! * can be specified as <code>\x{2011F}</code>, instead of two consecutive * Unicode escape sequences of the surrogate pair ! * <code>\uD840</code><code>\uDD1F</code>. * <p> * Unicode scripts, blocks, categories and binary properties are written with ! * the {@code \p} and {@code \P} constructs as in Perl. ! * <code>\p{</code><i>prop</i><code>}</code> matches if ! * the input has the property <i>prop</i>, while <code>\P{</code><i>prop</i><code>}</code> * does not match if the input has that property. * <p> * Scripts, blocks, categories and binary properties can be used both inside * and outside of a character class. * * <p> * <b><a name="usc">Scripts</a></b> are specified either with the prefix {@code Is}, as in * {@code IsHiragana}, or by using the {@code script} keyword (or its short * form {@code sc}) as in {@code script=Hiragana} or {@code sc=Hiragana}. * <p> ! * The script names supported by {@code Pattern} are the valid script names * accepted and defined by * {@link java.lang.Character.UnicodeScript#forName(String) UnicodeScript.forName}. * * <p> * <b><a name="ubc">Blocks</a></b> are specified with the prefix {@code In}, as in * {@code InMongolian}, or by using the keyword {@code block} (or its short * form {@code blk}) as in {@code block=Mongolian} or {@code blk=Mongolian}. * <p> ! * The block names supported by {@code Pattern} are the valid block names * accepted and defined by * {@link java.lang.Character.UnicodeBlock#forName(String) UnicodeBlock.forName}. * <p> * * <b><a name="ucc">Categories</a></b> may be specified with the optional prefix {@code Is}:
*** 593,603 **** * {@link java.lang.Character Character} class. The category names are those * defined in the Standard, both normative and informative. * <p> * * <b><a name="ubpc">Binary properties</a></b> are specified with the prefix {@code Is}, as in ! * {@code IsAlphabetic}. The supported binary properties by <code>Pattern</code> * are * <ul> * <li> Alphabetic * <li> Ideographic * <li> Letter --- 593,603 ---- * {@link java.lang.Character Character} class. The category names are those * defined in the Standard, both normative and informative. * <p> * * <b><a name="ubpc">Binary properties</a></b> are specified with the prefix {@code Is}, as in ! * {@code IsAlphabetic}. The supported binary properties by {@code Pattern} * are * <ul> * <li> Alphabetic * <li> Ideographic * <li> Letter
*** 623,714 **** * summary="predefined and posix character classes in Unicode mode"> * <tr align="left"> * <th align="left" id="predef_classes">Classes</th> * <th align="left" id="predef_matches">Matches</th> *</tr> ! * <tr><td><tt>\p{Lower}</tt></td> ! * <td>A lowercase character:<tt>\p{IsLowercase}</tt></td></tr> ! * <tr><td><tt>\p{Upper}</tt></td> ! * <td>An uppercase character:<tt>\p{IsUppercase}</tt></td></tr> ! * <tr><td><tt>\p{ASCII}</tt></td> ! * <td>All ASCII:<tt>[\x00-\x7F]</tt></td></tr> ! * <tr><td><tt>\p{Alpha}</tt></td> ! * <td>An alphabetic character:<tt>\p{IsAlphabetic}</tt></td></tr> ! * <tr><td><tt>\p{Digit}</tt></td> ! * <td>A decimal digit character:<tt>p{IsDigit}</tt></td></tr> ! * <tr><td><tt>\p{Alnum}</tt></td> ! * <td>An alphanumeric character:<tt>[\p{IsAlphabetic}\p{IsDigit}]</tt></td></tr> ! * <tr><td><tt>\p{Punct}</tt></td> ! * <td>A punctuation character:<tt>p{IsPunctuation}</tt></td></tr> ! * <tr><td><tt>\p{Graph}</tt></td> ! * <td>A visible character: <tt>[^\p{IsWhite_Space}\p{gc=Cc}\p{gc=Cs}\p{gc=Cn}]</tt></td></tr> ! * <tr><td><tt>\p{Print}</tt></td> * <td>A printable character: {@code [\p{Graph}\p{Blank}&&[^\p{Cntrl}]]}</td></tr> ! * <tr><td><tt>\p{Blank}</tt></td> * <td>A space or a tab: {@code [\p{IsWhite_Space}&&[^\p{gc=Zl}\p{gc=Zp}\x0a\x0b\x0c\x0d\x85]]}</td></tr> ! * <tr><td><tt>\p{Cntrl}</tt></td> ! * <td>A control character: <tt>\p{gc=Cc}</tt></td></tr> ! * <tr><td><tt>\p{XDigit}</tt></td> ! * <td>A hexadecimal digit: <tt>[\p{gc=Nd}\p{IsHex_Digit}]</tt></td></tr> ! * <tr><td><tt>\p{Space}</tt></td> ! * <td>A whitespace character:<tt>\p{IsWhite_Space}</tt></td></tr> ! * <tr><td><tt>\d</tt></td> ! * <td>A digit: <tt>\p{IsDigit}</tt></td></tr> ! * <tr><td><tt>\D</tt></td> ! * <td>A non-digit: <tt>[^\d]</tt></td></tr> ! * <tr><td><tt>\s</tt></td> ! * <td>A whitespace character: <tt>\p{IsWhite_Space}</tt></td></tr> ! * <tr><td><tt>\S</tt></td> ! * <td>A non-whitespace character: <tt>[^\s]</tt></td></tr> ! * <tr><td><tt>\w</tt></td> ! * <td>A word character: <tt>[\p{Alpha}\p{gc=Mn}\p{gc=Me}\p{gc=Mc}\p{Digit}\p{gc=Pc}\p{IsJoin_Control}]</tt></td></tr> ! * <tr><td><tt>\W</tt></td> ! * <td>A non-word character: <tt>[^\w]</tt></td></tr> * </table> * <p> * <a name="jcc"> * Categories that behave like the java.lang.Character * boolean is<i>methodname</i> methods (except for the deprecated ones) are ! * available through the same <tt>\p{</tt><i>prop</i><tt>}</tt> syntax where ! * the specified property has the name <tt>java<i>methodname</i></tt></a>. * * <h3> Comparison to Perl 5 </h3> * ! * <p>The <code>Pattern</code> engine performs traditional NFA-based matching * with ordered alternation as occurs in Perl 5. * * <p> Perl constructs not supported by this class: </p> * * <ul> * <li><p> Predefined character classes (Unicode character) ! * <p><tt>\X&nbsp;&nbsp;&nbsp;&nbsp;</tt>Match Unicode * <a href="http://www.unicode.org/reports/tr18/#Default_Grapheme_Clusters"> * <i>extended grapheme cluster</i></a> * </p></li> * ! * <li><p> The backreference constructs, <tt>\g{</tt><i>n</i><tt>}</tt> for * the <i>n</i><sup>th</sup><a href="#cg">capturing group</a> and ! * <tt>\g{</tt><i>name</i><tt>}</tt> for * <a href="#groupname">named-capturing group</a>. * </p></li> * ! * <li><p> The named character construct, <tt>\N{</tt><i>name</i><tt>}</tt> * for a Unicode character by its name. * </p></li> * * <li><p> The conditional constructs ! * <tt>(?(</tt><i>condition</i><tt>)</tt><i>X</i><tt>)</tt> and ! * <tt>(?(</tt><i>condition</i><tt>)</tt><i>X</i><tt>|</tt><i>Y</i><tt>)</tt>, * </p></li> * ! * <li><p> The embedded code constructs <tt>(?{</tt><i>code</i><tt>})</tt> ! * and <tt>(??{</tt><i>code</i><tt>})</tt>,</p></li> * ! * <li><p> The embedded comment syntax <tt>(?#comment)</tt>, and </p></li> * ! * <li><p> The preprocessing operations <tt>\l</tt> <tt>\u</tt>, ! * <tt>\L</tt>, and <tt>\U</tt>. </p></li> * * </ul> * * <p> Constructs supported by this class but not by Perl: </p> * --- 623,714 ---- * summary="predefined and posix character classes in Unicode mode"> * <tr align="left"> * <th align="left" id="predef_classes">Classes</th> * <th align="left" id="predef_matches">Matches</th> *</tr> ! * <tr><td>{@code \p{Lower}}</td> ! * <td>A lowercase character:{@code \p{IsLowercase}}</td></tr> ! * <tr><td>{@code \p{Upper}}</td> ! * <td>An uppercase character:{@code \p{IsUppercase}}</td></tr> ! * <tr><td>{@code \p{ASCII}}</td> ! * <td>All ASCII:{@code [\x00-\x7F]}</td></tr> ! * <tr><td>{@code \p{Alpha}}</td> ! * <td>An alphabetic character:{@code \p{IsAlphabetic}}</td></tr> ! * <tr><td>{@code \p{Digit}}</td> ! * <td>A decimal digit character:{@code p{IsDigit}}</td></tr> ! * <tr><td>{@code \p{Alnum}}</td> ! * <td>An alphanumeric character:{@code [\p{IsAlphabetic}\p{IsDigit}]}</td></tr> ! * <tr><td>{@code \p{Punct}}</td> ! * <td>A punctuation character:{@code p{IsPunctuation}}</td></tr> ! * <tr><td>{@code \p{Graph}}</td> ! * <td>A visible character: {@code [^\p{IsWhite_Space}\p{gc=Cc}\p{gc=Cs}\p{gc=Cn}]}</td></tr> ! * <tr><td>{@code \p{Print}}</td> * <td>A printable character: {@code [\p{Graph}\p{Blank}&&[^\p{Cntrl}]]}</td></tr> ! * <tr><td>{@code \p{Blank}}</td> * <td>A space or a tab: {@code [\p{IsWhite_Space}&&[^\p{gc=Zl}\p{gc=Zp}\x0a\x0b\x0c\x0d\x85]]}</td></tr> ! * <tr><td>{@code \p{Cntrl}}</td> ! * <td>A control character: {@code \p{gc=Cc}}</td></tr> ! * <tr><td>{@code \p{XDigit}}</td> ! * <td>A hexadecimal digit: {@code [\p{gc=Nd}\p{IsHex_Digit}]}</td></tr> ! * <tr><td>{@code \p{Space}}</td> ! * <td>A whitespace character:{@code \p{IsWhite_Space}}</td></tr> ! * <tr><td>{@code \d}</td> ! * <td>A digit: {@code \p{IsDigit}}</td></tr> ! * <tr><td>{@code \D}</td> ! * <td>A non-digit: {@code [^\d]}</td></tr> ! * <tr><td>{@code \s}</td> ! * <td>A whitespace character: {@code \p{IsWhite_Space}}</td></tr> ! * <tr><td>{@code \S}</td> ! * <td>A non-whitespace character: {@code [^\s]}</td></tr> ! * <tr><td>{@code \w}</td> ! * <td>A word character: {@code [\p{Alpha}\p{gc=Mn}\p{gc=Me}\p{gc=Mc}\p{Digit}\p{gc=Pc}\p{IsJoin_Control}]}</td></tr> ! * <tr><td>{@code \W}</td> ! * <td>A non-word character: {@code [^\w]}</td></tr> * </table> * <p> * <a name="jcc"> * Categories that behave like the java.lang.Character * boolean is<i>methodname</i> methods (except for the deprecated ones) are ! * available through the same <code>\p{</code><i>prop</i><code>}</code> syntax where ! * the specified property has the name <code>java<i>methodname</i></code></a>. * * <h3> Comparison to Perl 5 </h3> * ! * <p>The {@code Pattern} engine performs traditional NFA-based matching * with ordered alternation as occurs in Perl 5. * * <p> Perl constructs not supported by this class: </p> * * <ul> * <li><p> Predefined character classes (Unicode character) ! * <p><code>\X&nbsp;&nbsp;&nbsp;&nbsp;</code>Match Unicode * <a href="http://www.unicode.org/reports/tr18/#Default_Grapheme_Clusters"> * <i>extended grapheme cluster</i></a> * </p></li> * ! * <li><p> The backreference constructs, <code>\g{</code><i>n</i><code>}</code> for * the <i>n</i><sup>th</sup><a href="#cg">capturing group</a> and ! * <code>\g{</code><i>name</i><code>}</code> for * <a href="#groupname">named-capturing group</a>. * </p></li> * ! * <li><p> The named character construct, <code>\N{</code><i>name</i><code>}</code> * for a Unicode character by its name. * </p></li> * * <li><p> The conditional constructs ! * {@code (?(}<i>condition</i>{@code )}<i>X</i>{@code )} and ! * {@code (?(}<i>condition</i>{@code )}<i>X</i>{@code |}<i>Y</i>{@code )}, * </p></li> * ! * <li><p> The embedded code constructs <code>(?{</code><i>code</i><code>})</code> ! * and <code>(??{</code><i>code</i><code>})</code>,</p></li> * ! * <li><p> The embedded comment syntax {@code (?#comment)}, and </p></li> * ! * <li><p> The preprocessing operations {@code \l} <code>\u</code>, ! * {@code \L}, and {@code \U}. </p></li> * * </ul> * * <p> Constructs supported by this class but not by Perl: </p> *
*** 721,743 **** * * <p> Notable differences from Perl: </p> * * <ul> * ! * <li><p> In Perl, <tt>\1</tt> through <tt>\9</tt> are always interpreted ! * as back references; a backslash-escaped number greater than <tt>9</tt> is * treated as a back reference if at least that many subexpressions exist, * otherwise it is interpreted, if possible, as an octal escape. In this * class octal escapes must always begin with a zero. In this class, ! * <tt>\1</tt> through <tt>\9</tt> are always interpreted as back * references, and a larger number is accepted as a back reference if at * least that many subexpressions exist at that point in the regular * expression, otherwise the parser will drop digits until the number is * smaller or equal to the existing number of groups or it is one digit. * </p></li> * ! * <li><p> Perl uses the <tt>g</tt> flag to request a match that resumes * where the last match left off. This functionality is provided implicitly * by the {@link Matcher} class: Repeated invocations of the {@link * Matcher#find find} method will resume where the last match left off, * unless the matcher is reset. </p></li> * --- 721,743 ---- * * <p> Notable differences from Perl: </p> * * <ul> * ! * <li><p> In Perl, {@code \1} through {@code \9} are always interpreted ! * as back references; a backslash-escaped number greater than {@code 9} is * treated as a back reference if at least that many subexpressions exist, * otherwise it is interpreted, if possible, as an octal escape. In this * class octal escapes must always begin with a zero. In this class, ! * {@code \1} through {@code \9} are always interpreted as back * references, and a larger number is accepted as a back reference if at * least that many subexpressions exist at that point in the regular * expression, otherwise the parser will drop digits until the number is * smaller or equal to the existing number of groups or it is one digit. * </p></li> * ! * <li><p> Perl uses the {@code g} flag to request a match that resumes * where the last match left off. This functionality is provided implicitly * by the {@link Matcher} class: Repeated invocations of the {@link * Matcher#find find} method will resume where the last match left off, * unless the matcher is reset. </p></li> *
*** 784,798 **** */ /** * Enables Unix lines mode. * ! * <p> In this mode, only the <tt>'\n'</tt> line terminator is recognized ! * in the behavior of <tt>.</tt>, <tt>^</tt>, and <tt>$</tt>. * * <p> Unix lines mode can also be enabled via the embedded flag ! * expression&nbsp;<tt>(?d)</tt>. */ public static final int UNIX_LINES = 0x01; /** * Enables case-insensitive matching. --- 784,798 ---- */ /** * Enables Unix lines mode. * ! * <p> In this mode, only the {@code '\n'} line terminator is recognized ! * in the behavior of {@code .}, {@code ^}, and {@code $}. * * <p> Unix lines mode can also be enabled via the embedded flag ! * expression&nbsp;{@code (?d)}. */ public static final int UNIX_LINES = 0x01; /** * Enables case-insensitive matching.
*** 801,837 **** * in the US-ASCII charset are being matched. Unicode-aware * case-insensitive matching can be enabled by specifying the {@link * #UNICODE_CASE} flag in conjunction with this flag. * * <p> Case-insensitive matching can also be enabled via the embedded flag ! * expression&nbsp;<tt>(?i)</tt>. * * <p> Specifying this flag may impose a slight performance penalty. </p> */ public static final int CASE_INSENSITIVE = 0x02; /** * Permits whitespace and comments in pattern. * * <p> In this mode, whitespace is ignored, and embedded comments starting ! * with <tt>#</tt> are ignored until the end of a line. * * <p> Comments mode can also be enabled via the embedded flag ! * expression&nbsp;<tt>(?x)</tt>. */ public static final int COMMENTS = 0x04; /** * Enables multiline mode. * ! * <p> In multiline mode the expressions <tt>^</tt> and <tt>$</tt> match * just after or just before, respectively, a line terminator or the end of * the input sequence. By default these expressions only match at the * beginning and the end of the entire input sequence. * * <p> Multiline mode can also be enabled via the embedded flag ! * expression&nbsp;<tt>(?m)</tt>. </p> */ public static final int MULTILINE = 0x08; /** * Enables literal parsing of the pattern. --- 801,837 ---- * in the US-ASCII charset are being matched. Unicode-aware * case-insensitive matching can be enabled by specifying the {@link * #UNICODE_CASE} flag in conjunction with this flag. * * <p> Case-insensitive matching can also be enabled via the embedded flag ! * expression&nbsp;{@code (?i)}. * * <p> Specifying this flag may impose a slight performance penalty. </p> */ public static final int CASE_INSENSITIVE = 0x02; /** * 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. * * <p> Comments mode can also be enabled via the embedded flag ! * expression&nbsp;{@code (?x)}. */ public static final int COMMENTS = 0x04; /** * Enables multiline mode. * ! * <p> In multiline mode the expressions {@code ^} and {@code $} match * just after or just before, respectively, a line terminator or the end of * the input sequence. By default these expressions only match at the * beginning and the end of the entire input sequence. * * <p> Multiline mode can also be enabled via the embedded flag ! * expression&nbsp;{@code (?m)}. </p> */ public static final int MULTILINE = 0x08; /** * Enables literal parsing of the pattern.
*** 851,866 **** public static final int LITERAL = 0x10; /** * Enables dotall mode. * ! * <p> In dotall mode, the expression <tt>.</tt> matches any character, * including a line terminator. By default this expression does not match * line terminators. * * <p> Dotall mode can also be enabled via the embedded flag ! * expression&nbsp;<tt>(?s)</tt>. (The <tt>s</tt> is a mnemonic for * "single-line" mode, which is what this is called in Perl.) </p> */ public static final int DOTALL = 0x20; /** --- 851,866 ---- public static final int LITERAL = 0x10; /** * Enables dotall mode. * ! * <p> In dotall mode, the expression {@code .} matches any character, * including a line terminator. By default this expression does not match * line terminators. * * <p> Dotall mode can also be enabled via the embedded flag ! * expression&nbsp;{@code (?s)}. (The {@code s} is a mnemonic for * "single-line" mode, which is what this is called in Perl.) </p> */ public static final int DOTALL = 0x20; /**
*** 871,893 **** * consistent with the Unicode Standard. By default, case-insensitive * matching assumes that only characters in the US-ASCII charset are being * matched. * * <p> Unicode-aware case folding can also be enabled via the embedded flag ! * expression&nbsp;<tt>(?u)</tt>. * * <p> Specifying this flag may impose a performance penalty. </p> */ public static final int UNICODE_CASE = 0x40; /** * Enables canonical equivalence. * * <p> When this flag is specified then two characters will be considered * to match if, and only if, their full canonical decompositions match. ! * The expression <tt>"a\u030A"</tt>, for example, will match the ! * string <tt>"\u00E5"</tt> when this flag is specified. By default, * matching does not take canonical equivalence into account. * * <p> There is no embedded flag character for enabling canonical * equivalence. * --- 871,893 ---- * consistent with the Unicode Standard. By default, case-insensitive * matching assumes that only characters in the US-ASCII charset are being * matched. * * <p> Unicode-aware case folding can also be enabled via the embedded flag ! * expression&nbsp;{@code (?u)}. * * <p> Specifying this flag may impose a performance penalty. </p> */ public static final int UNICODE_CASE = 0x40; /** * Enables canonical equivalence. * * <p> When this flag is specified then two characters will be considered * to match if, and only if, their full canonical decompositions match. ! * The expression <code>"a\u030A"</code>, for example, will match the ! * string <code>"\u00E5"</code> when this flag is specified. By default, * matching does not take canonical equivalence into account. * * <p> There is no embedded flag character for enabling canonical * equivalence. *
*** 905,915 **** * <a href="http://www.unicode.org/reports/tr18/"><i>Unicode Technical * Standard #18: Unicode Regular Expression</i></a> * <i>Annex C: Compatibility Properties</i>. * <p> * The UNICODE_CHARACTER_CLASS mode can also be enabled via the embedded ! * flag expression&nbsp;<tt>(?U)</tt>. * <p> * The flag implies UNICODE_CASE, that is, it enables Unicode-aware case * folding. * <p> * Specifying this flag may impose a performance penalty. </p> --- 905,915 ---- * <a href="http://www.unicode.org/reports/tr18/"><i>Unicode Technical * Standard #18: Unicode Regular Expression</i></a> * <i>Annex C: Compatibility Properties</i>. * <p> * The UNICODE_CHARACTER_CLASS mode can also be enabled via the embedded ! * flag expression&nbsp;{@code (?U)}. * <p> * The flag implies UNICODE_CASE, that is, it enables Unicode-aware case * folding. * <p> * Specifying this flag may impose a performance penalty. </p>
*** 1050,1060 **** * and {@link #COMMENTS} * * @return the given regular expression compiled into a pattern with the given flags * @throws IllegalArgumentException * If bit values other than those corresponding to the defined ! * match flags are set in <tt>flags</tt> * * @throws PatternSyntaxException * If the expression's syntax is invalid */ public static Pattern compile(String regex, int flags) { --- 1050,1060 ---- * and {@link #COMMENTS} * * @return the given regular expression compiled into a pattern with the given flags * @throws IllegalArgumentException * If bit values other than those corresponding to the defined ! * match flags are set in {@code flags} * * @throws PatternSyntaxException * If the expression's syntax is invalid */ public static Pattern compile(String regex, int flags) {
*** 1156,1202 **** * <p> When there is a positive-width match at the beginning of the input * sequence then an empty leading substring is included at the beginning * of the resulting array. A zero-width match at the beginning however * never produces such empty leading substring. * ! * <p> The <tt>limit</tt> parameter controls the number of times the * pattern is applied and therefore affects the length of the resulting * array. If the limit <i>n</i> is greater than zero then the pattern * will be applied at most <i>n</i>&nbsp;-&nbsp;1 times, the array's * length will be no greater than <i>n</i>, and the array's last entry * will contain all input beyond the last matched delimiter. If <i>n</i> * is non-positive then the pattern will be applied as many times as * possible and the array can have any length. If <i>n</i> is zero then * the pattern will be applied as many times as possible, the array can * have any length, and trailing empty strings will be discarded. * ! * <p> The input <tt>"boo:and:foo"</tt>, for example, yields the following * results with these parameters: * * <blockquote><table cellpadding=1 cellspacing=0 * summary="Split examples showing regex, limit, and result"> * <tr><th align="left"><i>Regex&nbsp;&nbsp;&nbsp;&nbsp;</i></th> * <th align="left"><i>Limit&nbsp;&nbsp;&nbsp;&nbsp;</i></th> * <th align="left"><i>Result&nbsp;&nbsp;&nbsp;&nbsp;</i></th></tr> * <tr><td align=center>:</td> * <td align=center>2</td> ! * <td><tt>{ "boo", "and:foo" }</tt></td></tr> * <tr><td align=center>:</td> * <td align=center>5</td> ! * <td><tt>{ "boo", "and", "foo" }</tt></td></tr> * <tr><td align=center>:</td> * <td align=center>-2</td> ! * <td><tt>{ "boo", "and", "foo" }</tt></td></tr> * <tr><td align=center>o</td> * <td align=center>5</td> ! * <td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr> * <tr><td align=center>o</td> * <td align=center>-2</td> ! * <td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr> * <tr><td align=center>o</td> * <td align=center>0</td> ! * <td><tt>{ "b", "", ":and:f" }</tt></td></tr> * </table></blockquote> * * @param input * The character sequence to be split * --- 1156,1202 ---- * <p> When there is a positive-width match at the beginning of the input * sequence then an empty leading substring is included at the beginning * of the resulting array. A zero-width match at the beginning however * never produces such empty leading substring. * ! * <p> The {@code limit} parameter controls the number of times the * pattern is applied and therefore affects the length of the resulting * array. If the limit <i>n</i> is greater than zero then the pattern * will be applied at most <i>n</i>&nbsp;-&nbsp;1 times, the array's * length will be no greater than <i>n</i>, and the array's last entry * will contain all input beyond the last matched delimiter. If <i>n</i> * is non-positive then the pattern will be applied as many times as * possible and the array can have any length. If <i>n</i> is zero then * the pattern will be applied as many times as possible, the array can * have any length, and trailing empty strings will be discarded. * ! * <p> The input {@code "boo:and:foo"}, for example, yields the following * results with these parameters: * * <blockquote><table cellpadding=1 cellspacing=0 * summary="Split examples showing regex, limit, and result"> * <tr><th align="left"><i>Regex&nbsp;&nbsp;&nbsp;&nbsp;</i></th> * <th align="left"><i>Limit&nbsp;&nbsp;&nbsp;&nbsp;</i></th> * <th align="left"><i>Result&nbsp;&nbsp;&nbsp;&nbsp;</i></th></tr> * <tr><td align=center>:</td> * <td align=center>2</td> ! * <td>{@code { "boo", "and:foo" }}</td></tr> * <tr><td align=center>:</td> * <td align=center>5</td> ! * <td>{@code { "boo", "and", "foo" }}</td></tr> * <tr><td align=center>:</td> * <td align=center>-2</td> ! * <td>{@code { "boo", "and", "foo" }}</td></tr> * <tr><td align=center>o</td> * <td align=center>5</td> ! * <td>{@code { "b", "", ":and:f", "", "" }}</td></tr> * <tr><td align=center>o</td> * <td align=center>-2</td> ! * <td>{@code { "b", "", ":and:f", "", "" }}</td></tr> * <tr><td align=center>o</td> * <td align=center>0</td> ! * <td>{@code { "b", "", ":and:f" }}</td></tr> * </table></blockquote> * * @param input * The character sequence to be split *
*** 1254,1274 **** * <p> This method works as if by invoking the two-argument {@link * #split(java.lang.CharSequence, int) split} method with the given input * sequence and a limit argument of zero. Trailing empty strings are * therefore not included in the resulting array. </p> * ! * <p> The input <tt>"boo:and:foo"</tt>, for example, yields the following * results with these expressions: * * <blockquote><table cellpadding=1 cellspacing=0 * summary="Split examples showing regex and result"> * <tr><th align="left"><i>Regex&nbsp;&nbsp;&nbsp;&nbsp;</i></th> * <th align="left"><i>Result</i></th></tr> * <tr><td align=center>:</td> ! * <td><tt>{ "boo", "and", "foo" }</tt></td></tr> * <tr><td align=center>o</td> ! * <td><tt>{ "b", "", ":and:f" }</tt></td></tr> * </table></blockquote> * * * @param input * The character sequence to be split --- 1254,1274 ---- * <p> This method works as if by invoking the two-argument {@link * #split(java.lang.CharSequence, int) split} method with the given input * sequence and a limit argument of zero. Trailing empty strings are * therefore not included in the resulting array. </p> * ! * <p> The input {@code "boo:and:foo"}, for example, yields the following * results with these expressions: * * <blockquote><table cellpadding=1 cellspacing=0 * summary="Split examples showing regex and result"> * <tr><th align="left"><i>Regex&nbsp;&nbsp;&nbsp;&nbsp;</i></th> * <th align="left"><i>Result</i></th></tr> * <tr><td align=center>:</td> ! * <td>{@code { "boo", "and", "foo" }}</td></tr> * <tr><td align=center>o</td> ! * <td>{@code { "b", "", ":and:f" }}</td></tr> * </table></blockquote> * * * @param input * The character sequence to be split
*** 1279,1294 **** public String[] split(CharSequence input) { return split(input, 0); } /** ! * Returns a literal pattern <code>String</code> for the specified ! * <code>String</code>. * ! * <p>This method produces a <code>String</code> that can be used to ! * create a <code>Pattern</code> that would match the string ! * <code>s</code> as if it were a literal pattern.</p> Metacharacters * or escape sequences in the input sequence will be given no special * meaning. * * @param s The string to be literalized * @return A literal string replacement --- 1279,1294 ---- public String[] split(CharSequence input) { return split(input, 0); } /** ! * Returns a literal pattern {@code String} for the specified ! * {@code String}. * ! * <p>This method produces a {@code String} that can be used to ! * create a {@code Pattern} that would match the string ! * {@code s} as if it were a literal pattern.</p> Metacharacters * or escape sequences in the input sequence will be given no special * meaning. * * @param s The string to be literalized * @return A literal string replacement
< prev index next >