⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wcpattern.h

📁 C++正则表达式解析
💻 H
📖 第 1 页 / 共 4 页
字号:
      </td>
      <td>
        The end of input. Will also match if there is a single trailing
        <code>\r\n</code>, a single trailing <code>\r</code>, or a single
        trailing <code>\n</code>.
      </td>
    </tr>
    <tr>
      <td>
        <code>\z</code>
      </td>
      <td>
        The end of input
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Greedy Quantifiers</b>
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x?</i></code>
      </td>
      <td>
        <i>x</i>, either zero times or one time
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x*</i></code>
      </td>
      <td>
        <i>x</i>, zero or more times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x+</i></code>
      </td>
      <td>
        <i>x</i>, one or more times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n}</i></code>
      </td>
      <td>
        <i>x</i>, exactly n times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n,}</i></code>
      </td>
      <td>
        <i>x</i>, at least <code><i>n</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{,m}</i></code>
      </td>
      <td>
        <i>x</i>, at most <code><i>m</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n,m}</i></code>
      </td>
      <td>
        <i>x</i>, at least <code><i>n</i></code> times and at most
        <code><i>m</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Possessive Quantifiers</b>
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x?+</i></code>
      </td>
      <td>
        <i>x</i>, either zero times or one time
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x*+</i></code>
      </td>
      <td>
        <i>x</i>, zero or more times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x++</i></code>
      </td>
      <td>
        <i>x</i>, one or more times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n}+</i></code>
      </td>
      <td>
        <i>x</i>, exactly n times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n,}+</i></code>
      </td>
      <td>
        <i>x</i>, at least <code><i>n</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{,m}+</i></code>
      </td>
      <td>
        <i>x</i>, at most <code><i>m</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n,m}+</i></code>
      </td>
      <td>
        <i>x</i>, at least <code><i>n</i></code> times and at most
        <code><i>m</i></code> times
      </td>
    </tr>
    <tr>
      <td colspan="2">
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Reluctant Quantifiers</b>
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x??</i></code>
      </td>
      <td>
        <i>x</i>, either zero times or one time
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x*?</i></code>
      </td>
      <td>
        <i>x</i>, zero or more times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x+?</i></code>
      </td>
      <td>
        <i>x</i>, one or more times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n}?</i></code>
      </td>
      <td>
        <i>x</i>, exactly n times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n,}?</i></code>
      </td>
      <td>
        <i>x</i>, at least <code><i>n</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{,m}?</i></code>
      </td>
      <td>
        <i>x</i>, at most <code><i>m</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x{n,m}?</i></code>
      </td>
      <td>
        <i>x</i>, at least <code><i>n</i></code> times and at most
        <code><i>m</i></code> times
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Operators</b>
      </td>
    </tr>
    <tr>
      <td>
        <code><i>xy</i></code>
      </td>
      <td>
        <code><i>x</i></code> then <code><i>y</i></code>
      </td>
    </tr>
    <tr>
      <td>
        <code><i>x</i></code>|<code><i>y</i></code>
      </td>
      <td>
        <code><i>x</i></code> or <code><i>y</i></code>
      </td>
    </tr>
    <tr>
      <td>
        <code>(<i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i></code> as a capturing group
      </td>
    </tr>
    <tr>
      <td colspan="2">
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Quoting</b>
      </td>
    </tr>
    <tr>
      <td>
        <code>\Q</code>
      </td>
      <td>
        Nothing, but treat every character (including \s) literally until a
        matching <code>\E</code>
      </td>
    </tr>
    <tr>
      <td>
        <code>\E</code>
      </td>
      <td>
        Nothing, but ends its matching <code>\Q</code>
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Special Constructs</b>
      </td>
    </tr>
    <tr>
      <td>
        <code>(?:<i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i></code>, but not as a capturing group
      </td>
    </tr>
    <tr>
      <td>
        <code>(?=<i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i></code>, via positive lookahead. This means that the
        expression will match only if it is trailed by <code><i>x</i></code>.
        It will not "eat" any of the characters matched by
        <code><i>x</i></code>.
      </td>
    </tr>
    <tr>
      <td>
        <code>(?!<i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i></code>, via negative lookahead. This means that the
        expression will match only if it is not trailed by
        <code><i>x</i></code>. It will not "eat" any of the characters
        matched by <code><i>x</i></code>.
      </td>
    </tr>
    <tr>
      <td>
        <code>(?<=<i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i></code>, via positive lookbehind. <code><i>x</i></code>
        cannot contain any quantifiers.
      </td>
    </tr>
    <tr>
      <td>
        <code>(?<!<i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i></code>, via negative lookbehind. <code><i>x</i></code>
        cannot contain any quantifiers.
      </td>
    </tr>
    <tr>
      <td>
        <code>(?><i>x</i>)</code>
      </td>
      <td>
        <code><i>x</i>{1}+</code>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <b>Registered Expression Matching</b>
      </td>
    </tr>
    <tr>
      <td>
        <code>{<i>x</i>}</code>
      </td>
      <td>
        The registered pattern <code><i>x</i></code>
      </td>
    </tr>
  </table>

  <hr>

   <i>Begin Text Extracted And Modified From java.util.regex.WCPattern documentation</i>

   <h4> Backslashes, escapes, and quoting </h4>

   <p> The backslash character (<tt>(wchar_t)'\'</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
   prior to a non-alphabetic character regardless of whether that character is
   part of an unescaped construct.

   <p>It is necessary to double backslashes in string literals that represent
   regular expressions to protect them from interpretation by a compiler.  The
   string literal <tt>"&#92;b"</tt>, for example, matches a single backspace
   character when interpreted as a regular expression, while
   <tt>"&#92;&#92;b"</tt> matches a word boundary.  The string litera
    <tt>"&#92;(hello&#92;)"</tt> is illegal and leads to a compile-time error;
    in order to match the string <tt>(hello)</tt> the string literal
    <tt>"&#92;&#92;(hello&#92;&#92;)"</tt> must be used.

   <h4> Character Classes </h4>

      <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.

      <p> The precedence of character-class operators is as follows, from
      highest to lowest:

      <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>Range</td>
            <td><tt>a-z</tt></td></tr>
        <tr><th>3&nbsp;&nbsp;&nbsp;&nbsp;</th>
            <td>Grouping</td>
            <td><tt>[...]</tt></td></tr>
        <tr><th>4&nbsp;&nbsp;&nbsp;&nbsp;</th>
            <td>Intersection</td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -