<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="regexp">
      </a>
      14.8.2 Regular Expressions
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045202491536">
  </a>
  <a class="indexterm" name="idm46045202490464">
  </a>
  <a class="indexterm" name="idm46045202489392">
  </a>
  <a class="indexterm" name="idm46045202488304">
  </a>
  <div class="table">
   <a name="idm46045202486816">
   </a>
   <p class="title">
    <b>
     Table 14.14 Regular Expression Functions and
Operators
    </b>
   </p>
   <div class="table-contents">
    <table frame="box" rules="all" summary="A reference that lists regular expression functions and operators.">
     <colgroup>
      <col style="width: 28%"/>
      <col style="width: 71%"/>
     </colgroup>
     <thead>
      <tr>
       <th>
        Name
       </th>
       <th>
        Description
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td>
        <a class="link" href="regexp.html#operator_not-regexp">
         <code class="literal">
          NOT REGEXP
         </code>
        </a>
       </td>
       <td>
        Negation of REGEXP
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#operator_regexp">
         <code class="literal">
          REGEXP
         </code>
        </a>
       </td>
       <td>
        Whether string matches regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-instr">
         <code class="literal">
          REGEXP_INSTR()
         </code>
        </a>
       </td>
       <td>
        Starting index of substring matching regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-like">
         <code class="literal">
          REGEXP_LIKE()
         </code>
        </a>
       </td>
       <td>
        Whether string matches regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-replace">
         <code class="literal">
          REGEXP_REPLACE()
         </code>
        </a>
       </td>
       <td>
        Replace substrings matching regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-substr">
         <code class="literal">
          REGEXP_SUBSTR()
         </code>
        </a>
       </td>
       <td>
        Return substring matching regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#operator_regexp">
         <code class="literal">
          RLIKE
         </code>
        </a>
       </td>
       <td>
        Whether string matches regular expression
       </td>
      </tr>
     </tbody>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <p>
   A regular expression is a powerful way of specifying a pattern
        for a complex search. This section discusses the functions and
        operators available for regular expression matching and
        illustrates, with examples, some of the special characters and
        constructs that can be used for regular expression operations.
        See also
   <a class="xref" href="pattern-matching.html" title="5.3.4.7 Pattern Matching">
    Section 5.3.4.7, “Pattern Matching”
   </a>
   .
  </p>
  <p>
   MySQL implements regular expression support using International
        Components for Unicode (ICU), which provides full Unicode
        support and is multibyte safe.
  </p>
  <p>
   Use of a binary string with any of the MySQL regular expression
        functions is rejected with
   <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_character_set_mismatch" target="_top">
    <code class="literal">
     ER_CHARACTER_SET_MISMATCH
    </code>
   </a>
   .
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="regexp.html#regexp-operator-descriptions" title="Regular Expression Function and Operator Descriptions">
       Regular Expression Function and Operator Descriptions
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="regexp.html#regexp-syntax" title="Regular Expression Syntax">
       Regular Expression Syntax
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="regexp.html#regexp-resource-control" title="Regular Expression Resource Control">
       Regular Expression Resource Control
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="regexp-operator-descriptions">
       </a>
       Regular Expression Function and Operator Descriptions
      </h4>
     </div>
    </div>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <a name="operator_not-regexp">
      </a>
      <p>
       <a class="link" href="regexp.html#operator_not-regexp">
        <code class="literal">
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         NOT REGEXP
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
        </code>
       </a>
       ,
       <a class="link" href="regexp.html#operator_not-regexp">
        <code class="literal">
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         NOT RLIKE
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
        </code>
       </a>
      </p>
      <a class="indexterm" name="idm46045202444368">
      </a>
      <p>
       This is the same as
       <code class="literal">
        NOT
              (
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        REGEXP
        <em class="replaceable">
         <code>
          pat
         </code>
        </em>
        )
       </code>
       .
      </p>
     </li>
     <li class="listitem">
      <a name="operator_regexp">
      </a>
      <p>
       <a class="link" href="regexp.html#operator_regexp">
        <code class="literal">
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         REGEXP
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
        </code>
       </a>
       ,
       <a class="link" href="regexp.html#operator_regexp">
        <code class="literal">
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         RLIKE
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
        </code>
       </a>
      </p>
      <a class="indexterm" name="idm46045202432976">
      </a>
      <a class="indexterm" name="idm46045202431904">
      </a>
      <p>
       Returns 1 if the string
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       matches the regular expression specified by the pattern
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       , 0 otherwise. If
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       or
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       is
       <code class="literal">
        NULL
       </code>
       ,
              the return value is
       <code class="literal">
        NULL
       </code>
       .
      </p>
      <p>
       <a class="link" href="regexp.html#operator_regexp">
        <code class="literal">
         REGEXP
        </code>
       </a>
       and
       <a class="link" href="regexp.html#operator_regexp">
        <code class="literal">
         RLIKE
        </code>
       </a>
       are
              synonyms for
       <a class="link" href="regexp.html#function_regexp-like">
        <code class="literal">
         REGEXP_LIKE()
        </code>
       </a>
       .
      </p>
      <p>
       For additional information about how matching occurs, see
              the description for
       <a class="link" href="regexp.html#function_regexp-like">
        <code class="literal">
         REGEXP_LIKE()
        </code>
       </a>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51708473"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token string">'Michael!'</span> <span class="token operator">REGEXP</span> <span class="token string">'.*'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 'Michael!' REGEXP '.*' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                      1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token string">'new*\n*line'</span> <span class="token operator">REGEXP</span> <span class="token string">'new\\*.\\*line'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 'new*\n*line' REGEXP 'new\\*.\\*line' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                     0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token string">'a'</span> <span class="token operator">REGEXP</span> <span class="token string">'^[a-d]'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 'a' REGEXP '^[a<span class="token punctuation">-</span>d]' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                   1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <a name="function_regexp-instr">
      </a>
      <p>
       <a class="link" href="regexp.html#function_regexp-instr">
        <code class="literal">
         REGEXP_INSTR(
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         ,
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           pos
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           occurrence
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           return_option
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           match_type
          </code>
         </em>
         ]]]])
        </code>
       </a>
      </p>
      <a class="indexterm" name="idm46045202408144">
      </a>
      <p>
       Returns the starting index of the substring of the string
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       that matches the regular
              expression specified by the pattern
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       , 0 if there is no match. If
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       or
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       is
       <code class="literal">
        NULL
       </code>
       ,
              the return value is
       <code class="literal">
        NULL
       </code>
       . Character
              indexes begin at 1.
      </p>
      <p>
       <a class="link" href="regexp.html#function_regexp-instr">
        <code class="literal">
         REGEXP_INSTR()
        </code>
       </a>
       takes these
              optional arguments:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            pos
           </code>
          </em>
          : The position in
          <em class="replaceable">
           <code>
            expr
           </code>
          </em>
          at which to start the
                  search. If omitted, the default is 1.
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            occurrence
           </code>
          </em>
          : Which
                  occurrence of a match to search for. If omitted, the
                  default is 1.
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            return_option
           </code>
          </em>
          : Which type
                  of position to return. If this value is 0,
          <a class="link" href="regexp.html#function_regexp-instr">
           <code class="literal">
            REGEXP_INSTR()
           </code>
          </a>
          returns
                  the position of the matched substring's first
                  character. If this value is 1,
          <a class="link" href="regexp.html#function_regexp-instr">
           <code class="literal">
            REGEXP_INSTR()
           </code>
          </a>
          returns
                  the position following the matched substring. If
                  omitted, the default is 0.
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            match_type
           </code>
          </em>
          : A string that
                  specifies how to perform matching. The meaning is as
                  described for
          <a class="link" href="regexp.html#function_regexp-like">
           <code class="literal">
            REGEXP_LIKE()
           </code>
          </a>
          .
         </p>
        </li>
       </ul>
      </div>
      <p>
       For additional information about how matching occurs, see
              the description for
       <a class="link" href="regexp.html#function_regexp-like">
        <code class="literal">
         REGEXP_LIKE()
        </code>
       </a>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46406074"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_INSTR</span><span class="token punctuation">(</span><span class="token string">'dog cat dog'</span><span class="token punctuation">,</span> <span class="token string">'dog'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_INSTR('dog cat dog', 'dog') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                  1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_INSTR</span><span class="token punctuation">(</span><span class="token string">'dog cat dog'</span><span class="token punctuation">,</span> <span class="token string">'dog'</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_INSTR('dog cat dog', 'dog', 2) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                     9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_INSTR</span><span class="token punctuation">(</span><span class="token string">'aa aaa aaaa'</span><span class="token punctuation">,</span> <span class="token string">'a{2}'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_INSTR('aa aaa aaaa', 'a{2}') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                   1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_INSTR</span><span class="token punctuation">(</span><span class="token string">'aa aaa aaaa'</span><span class="token punctuation">,</span> <span class="token string">'a{4}'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_INSTR('aa aaa aaaa', 'a{4}') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                   8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <a name="function_regexp-like">
      </a>
      <p>
       <a class="link" href="regexp.html#function_regexp-like">
        <code class="literal">
         REGEXP_LIKE(
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         ,
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           match_type
          </code>
         </em>
         ])
        </code>
       </a>
      </p>
      <a class="indexterm" name="idm46045202377232">
      </a>
      <p>
       Returns 1 if the string
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       matches the regular expression specified by the pattern
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       , 0 otherwise. If
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       or
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       is
       <code class="literal">
        NULL
       </code>
       ,
              the return value is
       <code class="literal">
        NULL
       </code>
       .
      </p>
      <p>
       The pattern can be an extended regular expression, the
              syntax for which is discussed in
       <a class="xref" href="regexp.html#regexp-syntax" title="Regular Expression Syntax">
        Regular Expression Syntax
       </a>
       . The pattern need not be a
              literal string. For example, it can be specified as a
              string expression or table column.
      </p>
      <p>
       The optional
       <em class="replaceable">
        <code>
         match_type
        </code>
       </em>
       argument is a string that may contain any or all the
              following characters specifying how to perform matching:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          <code class="literal">
           c
          </code>
          : Case-sensitive matching.
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="literal">
           i
          </code>
          : Case-insensitive matching.
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="literal">
           m
          </code>
          : Multiple-line mode. Recognize
                  line terminators within the string. The default
                  behavior is to match line terminators only at the
                  start and end of the string expression.
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="literal">
           n
          </code>
          : The
          <code class="literal">
           .
          </code>
          character matches line terminators. The default is for
          <code class="literal">
           .
          </code>
          matching to stop at the end of a
                  line.
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="literal">
           u
          </code>
          : Unix-only line endings. Only the
                  newline character is recognized as a line ending by
                  the
          <code class="literal">
           .
          </code>
          ,
          <code class="literal">
           ^
          </code>
          , and
          <code class="literal">
           $
          </code>
          match operators.
         </p>
        </li>
       </ul>
      </div>
      <p>
       If characters specifying contradictory options are
              specified within
       <em class="replaceable">
        <code>
         match_type
        </code>
       </em>
       ,
              the rightmost one takes precedence.
      </p>
      <p>
       By default, regular expression operations use the
              character set and collation of the
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       and
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       arguments when deciding the
              type of a character and performing the comparison. If the
              arguments have different character sets or collations,
              coercibility rules apply as described in
       <a class="xref" href="charset-collation-coercibility.html" title="12.8.4 Collation Coercibility in Expressions">
        Section 12.8.4, “Collation Coercibility in Expressions”
       </a>
       .
              Arguments may be specified with explicit collation
              indicators to change comparison behavior.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6957101"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'CamelCase'</span><span class="token punctuation">,</span> <span class="token string">'CAMELCASE'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('CamelCase', 'CAMELCASE') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                     1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'CamelCase'</span><span class="token punctuation">,</span> <span class="token string">'CAMELCASE'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_as_cs<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('CamelCase', 'CAMELCASE' COLLATE utf8mb4_0900_as_cs) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                                                0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
      <p>
       <em class="replaceable">
        <code>
         match_type
        </code>
       </em>
       may be specified
              with the
       <code class="literal">
        c
       </code>
       or
       <code class="literal">
        i
       </code>
       characters to override the default case sensitivity.
              Exception: If either argument is a binary string, the
              arguments are handled in case-sensitive fashion as binary
              strings, even if
       <em class="replaceable">
        <code>
         match_type
        </code>
       </em>
       contains the
       <code class="literal">
        i
       </code>
       character.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        MySQL uses C escape syntax in strings (for example,
        <code class="literal">
         \n
        </code>
        to represent the newline
                character). If you want your
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        or
        <em class="replaceable">
         <code>
          pat
         </code>
        </em>
        argument to contain a
                literal
        <code class="literal">
         \
        </code>
        , you must double it.
                (Unless the
        <a class="link" href="sql-mode.html#sqlmode_no_backslash_escapes">
         <code class="literal">
          NO_BACKSLASH_ESCAPES
         </code>
        </a>
        SQL mode is enabled, in which case no escape character
                is used.)
       </p>
      </div>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99587389"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Michael!'</span><span class="token punctuation">,</span> <span class="token string">'.*'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('Michael!', '.*') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                             1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'new*\n*line'</span><span class="token punctuation">,</span> <span class="token string">'new\\*.\\*line'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('new*\n*line', 'new\\*.\\*line') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                            0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">,</span> <span class="token string">'^[a-d]'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('a', '^[a<span class="token punctuation">-</span>d]') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                          1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47306581"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token string">'ABC'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('abc', 'ABC') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                         1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token string">'ABC'</span><span class="token punctuation">,</span> <span class="token string">'c'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_LIKE('abc', 'ABC', 'c') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                              0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <a name="function_regexp-replace">
      </a>
      <p>
       <a class="link" href="regexp.html#function_regexp-replace">
        <code class="literal">
         REGEXP_REPLACE(
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         ,
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
         ,
         <em class="replaceable">
          <code>
           repl
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           pos
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           occurrence
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           match_type
          </code>
         </em>
         ]]])
        </code>
       </a>
      </p>
      <a class="indexterm" name="idm46045202327888">
      </a>
      <p>
       Replaces occurrences in the string
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       that match the regular
              expression specified by the pattern
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       with the replacement string
       <em class="replaceable">
        <code>
         repl
        </code>
       </em>
       , and returns the resulting
              string. If
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       , or
       <em class="replaceable">
        <code>
         repl
        </code>
       </em>
       is
       <code class="literal">
        NULL
       </code>
       , the return value is
       <code class="literal">
        NULL
       </code>
       .
      </p>
      <p>
       <a class="link" href="regexp.html#function_regexp-replace">
        <code class="literal">
         REGEXP_REPLACE()
        </code>
       </a>
       takes
              these optional arguments:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            pos
           </code>
          </em>
          : The position in
          <em class="replaceable">
           <code>
            expr
           </code>
          </em>
          at which to start the
                  search. If omitted, the default is 1.
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            occurrence
           </code>
          </em>
          : Which
                  occurrence of a match to replace. If omitted, the
                  default is 0 (which means
          <span class="quote">
           “
           <span class="quote">
            replace all
                  occurrences
           </span>
           ”
          </span>
          ).
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            match_type
           </code>
          </em>
          : A string that
                  specifies how to perform matching. The meaning is as
                  described for
          <a class="link" href="regexp.html#function_regexp-like">
           <code class="literal">
            REGEXP_LIKE()
           </code>
          </a>
          .
         </p>
        </li>
       </ul>
      </div>
      <p>
       The result returned by this function uses the character
              set and collation of the expression searched for matches.
      </p>
      <p>
       For additional information about how matching occurs, see
              the description for
       <a class="link" href="regexp.html#function_regexp-like">
        <code class="literal">
         REGEXP_LIKE()
        </code>
       </a>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60205605"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_REPLACE</span><span class="token punctuation">(</span><span class="token string">'a b c'</span><span class="token punctuation">,</span> <span class="token string">'b'</span><span class="token punctuation">,</span> <span class="token string">'X'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_REPLACE('a b c', 'b', 'X') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a X c                             <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_REPLACE</span><span class="token punctuation">(</span><span class="token string">'abc def ghi'</span><span class="token punctuation">,</span> <span class="token string">'[a-z]+'</span><span class="token punctuation">,</span> <span class="token string">'X'</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_REPLACE('abc def ghi', '[a<span class="token punctuation">-</span>z]<span class="token punctuation">+</span>', 'X', 1, 3) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> abc def X                                          <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <a name="function_regexp-substr">
      </a>
      <p>
       <a class="link" href="regexp.html#function_regexp-substr">
        <code class="literal">
         REGEXP_SUBSTR(
         <em class="replaceable">
          <code>
           expr
          </code>
         </em>
         ,
         <em class="replaceable">
          <code>
           pat
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           pos
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           occurrence
          </code>
         </em>
         [,
         <em class="replaceable">
          <code>
           match_type
          </code>
         </em>
         ]]])
        </code>
       </a>
      </p>
      <a class="indexterm" name="idm46045202300352">
      </a>
      <p>
       Returns the substring of the string
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       that matches the regular
              expression specified by the pattern
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       ,
       <code class="literal">
        NULL
       </code>
       if
              there is no match. If
       <em class="replaceable">
        <code>
         expr
        </code>
       </em>
       or
       <em class="replaceable">
        <code>
         pat
        </code>
       </em>
       is
       <code class="literal">
        NULL
       </code>
       ,
              the return value is
       <code class="literal">
        NULL
       </code>
       .
      </p>
      <p>
       <a class="link" href="regexp.html#function_regexp-substr">
        <code class="literal">
         REGEXP_SUBSTR()
        </code>
       </a>
       takes these
              optional arguments:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            pos
           </code>
          </em>
          : The position in
          <em class="replaceable">
           <code>
            expr
           </code>
          </em>
          at which to start the
                  search. If omitted, the default is 1.
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            occurrence
           </code>
          </em>
          : Which
                  occurrence of a match to search for. If omitted, the
                  default is 1.
         </p>
        </li>
        <li class="listitem">
         <p>
          <em class="replaceable">
           <code>
            match_type
           </code>
          </em>
          : A string that
                  specifies how to perform matching. The meaning is as
                  described for
          <a class="link" href="regexp.html#function_regexp-like">
           <code class="literal">
            REGEXP_LIKE()
           </code>
          </a>
          .
         </p>
        </li>
       </ul>
      </div>
      <p>
       The result returned by this function uses the character
              set and collation of the expression searched for matches.
      </p>
      <p>
       For additional information about how matching occurs, see
              the description for
       <a class="link" href="regexp.html#function_regexp-like">
        <code class="literal">
         REGEXP_LIKE()
        </code>
       </a>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40903981"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_SUBSTR</span><span class="token punctuation">(</span><span class="token string">'abc def ghi'</span><span class="token punctuation">,</span> <span class="token string">'[a-z]+'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_SUBSTR('abc def ghi', '[a<span class="token punctuation">-</span>z]<span class="token punctuation">+</span>') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> abc                                    <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_SUBSTR</span><span class="token punctuation">(</span><span class="token string">'abc def ghi'</span><span class="token punctuation">,</span> <span class="token string">'[a-z]+'</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> REGEXP_SUBSTR('abc def ghi', '[a<span class="token punctuation">-</span>z]<span class="token punctuation">+</span>', 1, 3) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ghi                                          <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
      </div>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="regexp-syntax">
       </a>
       Regular Expression Syntax
      </h4>
     </div>
    </div>
   </div>
   <p>
    A regular expression describes a set of strings. The simplest
          regular expression is one that has no special characters in
          it. For example, the regular expression
    <code class="literal">
     hello
    </code>
    matches
    <code class="literal">
     hello
    </code>
    and
          nothing else.
   </p>
   <p>
    Nontrivial regular expressions use certain special constructs
          so that they can match more than one string. For example, the
          regular expression
    <code class="literal">
     hello|world
    </code>
    contains the
    <code class="literal">
     |
    </code>
    alternation operator and matches either
          the
    <code class="literal">
     hello
    </code>
    or
    <code class="literal">
     world
    </code>
    .
   </p>
   <p>
    As a more complex example, the regular expression
    <code class="literal">
     B[an]*s
    </code>
    matches any of the strings
    <code class="literal">
     Bananas
    </code>
    ,
    <code class="literal">
     Baaaaas
    </code>
    ,
    <code class="literal">
     Bs
    </code>
    , and any other string starting with a
    <code class="literal">
     B
    </code>
    , ending with an
    <code class="literal">
     s
    </code>
    , and
          containing any number of
    <code class="literal">
     a
    </code>
    or
    <code class="literal">
     n
    </code>
    characters in between.
   </p>
   <p>
    The following list covers some of the basic special characters
          and constructs that can be used in regular expressions. For
          information about the full regular expression syntax supported
          by the ICU library used to implement regular expression
          support, visit the
    <a class="ulink" href="https://unicode-org.github.io/icu/userguide/" target="_blank">
     International Components for Unicode web site
    </a>
    .
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        ^
       </code>
      </p>
      <p>
       Match the beginning of a string.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11036312"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fo\nfo'</span><span class="token punctuation">,</span> <span class="token string">'^fo$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                   <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fofo'</span><span class="token punctuation">,</span> <span class="token string">'^fo'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                      <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        $
       </code>
      </p>
      <p>
       Match the end of a string.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91304811"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fo\no'</span><span class="token punctuation">,</span> <span class="token string">'^fo\no$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                 <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fo\no'</span><span class="token punctuation">,</span> <span class="token string">'^fo$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        .
       </code>
      </p>
      <p>
       Match any character (including carriage return and
              newline, although to match these in the middle of a
              string, the
       <code class="literal">
        m
       </code>
       (multiple line)
              match-control character or the
       <code class="literal">
        (?m)
       </code>
       within-pattern modifier must be given).
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84742501"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fofo'</span><span class="token punctuation">,</span> <span class="token string">'^f.*$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fo\r\nfo'</span><span class="token punctuation">,</span> <span class="token string">'^f.*$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fo\r\nfo'</span><span class="token punctuation">,</span> <span class="token string">'^f.*$'</span><span class="token punctuation">,</span> <span class="token string">'m'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>           <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'fo\r\nfo'</span><span class="token punctuation">,</span> <span class="token string">'(?m)^f.*$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>           <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        a*
       </code>
      </p>
      <p>
       Match any sequence of zero or more
       <code class="literal">
        a
       </code>
       characters.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70442481"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Ban'</span><span class="token punctuation">,</span> <span class="token string">'^Ba*n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                     <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Baaan'</span><span class="token punctuation">,</span> <span class="token string">'^Ba*n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                   <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Bn'</span><span class="token punctuation">,</span> <span class="token string">'^Ba*n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                      <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        a+
       </code>
      </p>
      <p>
       Match any sequence of one or more
       <code class="literal">
        a
       </code>
       characters.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69446014"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Ban'</span><span class="token punctuation">,</span> <span class="token string">'^Ba+n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                     <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Bn'</span><span class="token punctuation">,</span> <span class="token string">'^Ba+n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                      <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        a?
       </code>
      </p>
      <p>
       Match either zero or one
       <code class="literal">
        a
       </code>
       character.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38834136"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Bn'</span><span class="token punctuation">,</span> <span class="token string">'^Ba?n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                      <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Ban'</span><span class="token punctuation">,</span> <span class="token string">'^Ba?n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                     <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'Baan'</span><span class="token punctuation">,</span> <span class="token string">'^Ba?n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        de|abc
       </code>
      </p>
      <p>
       Alternation; match either of the sequences
       <code class="literal">
        de
       </code>
       or
       <code class="literal">
        abc
       </code>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46986600"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'pi'</span><span class="token punctuation">,</span> <span class="token string">'pi|apa'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                     <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'axe'</span><span class="token punctuation">,</span> <span class="token string">'pi|apa'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'apa'</span><span class="token punctuation">,</span> <span class="token string">'pi|apa'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'apa'</span><span class="token punctuation">,</span> <span class="token string">'^(pi|apa)$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'pi'</span><span class="token punctuation">,</span> <span class="token string">'^(pi|apa)$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                 <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'pix'</span><span class="token punctuation">,</span> <span class="token string">'^(pi|apa)$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        (abc)*
       </code>
      </p>
      <p>
       Match zero or more instances of the sequence
       <code class="literal">
        abc
       </code>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17589560"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'pi'</span><span class="token punctuation">,</span> <span class="token string">'^(pi)*$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                    <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'pip'</span><span class="token punctuation">,</span> <span class="token string">'^(pi)*$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                   <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'pipi'</span><span class="token punctuation">,</span> <span class="token string">'^(pi)*$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                  <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        {1}
       </code>
       ,
       <code class="literal">
        {2,3}
       </code>
      </p>
      <p>
       Repetition;
       <code class="literal">
        {
        <em class="replaceable">
         <code>
          n
         </code>
        </em>
        }
       </code>
       and
       <code class="literal">
        {
        <em class="replaceable">
         <code>
          m
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          n
         </code>
        </em>
        }
       </code>
       notation provide a more general way of writing regular
              expressions that match many occurrences of the previous
              atom (or
       <span class="quote">
        “
        <span class="quote">
         piece
        </span>
        ”
       </span>
       ) of the pattern.
       <em class="replaceable">
        <code>
         m
        </code>
       </em>
       and
       <em class="replaceable">
        <code>
         n
        </code>
       </em>
       are integers.
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          <code class="literal">
           a*
          </code>
         </p>
         <p>
          Can be written as
          <code class="literal">
           a{0,}
          </code>
          .
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="literal">
           a+
          </code>
         </p>
         <p>
          Can be written as
          <code class="literal">
           a{1,}
          </code>
          .
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="literal">
           a?
          </code>
         </p>
         <p>
          Can be written as
          <code class="literal">
           a{0,1}
          </code>
          .
         </p>
        </li>
       </ul>
      </div>
      <p>
       To be more precise,
       <code class="literal">
        a{
        <em class="replaceable">
         <code>
          n
         </code>
        </em>
        }
       </code>
       matches
              exactly
       <em class="replaceable">
        <code>
         n
        </code>
       </em>
       instances of
       <code class="literal">
        a
       </code>
       .
       <code class="literal">
        a{
        <em class="replaceable">
         <code>
          n
         </code>
        </em>
        ,}
       </code>
       matches
       <em class="replaceable">
        <code>
         n
        </code>
       </em>
       or more instances of
       <code class="literal">
        a
       </code>
       .
       <code class="literal">
        a{
        <em class="replaceable">
         <code>
          m
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          n
         </code>
        </em>
        }
       </code>
       matches
       <em class="replaceable">
        <code>
         m
        </code>
       </em>
       through
       <em class="replaceable">
        <code>
         n
        </code>
       </em>
       instances of
       <code class="literal">
        a
       </code>
       , inclusive. If both
       <em class="replaceable">
        <code>
         m
        </code>
       </em>
       and
       <em class="replaceable">
        <code>
         n
        </code>
       </em>
       are given,
       <em class="replaceable">
        <code>
         m
        </code>
       </em>
       must be less than or equal to
       <em class="replaceable">
        <code>
         n
        </code>
       </em>
       .
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30274226"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'abcde'</span><span class="token punctuation">,</span> <span class="token string">'a[bcd]{2}e'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>              <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'abcde'</span><span class="token punctuation">,</span> <span class="token string">'a[bcd]{3}e'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>              <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'abcde'</span><span class="token punctuation">,</span> <span class="token string">'a[bcd]{1,10}e'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>           <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        [a-dX]
       </code>
       ,
       <code class="literal">
        [^a-dX]
       </code>
      </p>
      <p>
       Matches any character that is (or is not, if
       <code class="literal">
        ^
       </code>
       is used) either
       <code class="literal">
        a
       </code>
       ,
       <code class="literal">
        b
       </code>
       ,
       <code class="literal">
        c
       </code>
       ,
       <code class="literal">
        d
       </code>
       or
       <code class="literal">
        X
       </code>
       . A
       <code class="literal">
        -
       </code>
       character between two other
              characters forms a range that matches all characters from
              the first character to the second. For example,
       <code class="literal">
        [0-9]
       </code>
       matches any decimal digit. To
              include a literal
       <code class="literal">
        ]
       </code>
       character, it must
              immediately follow the opening bracket
       <code class="literal">
        [
       </code>
       . To include a literal
       <code class="literal">
        -
       </code>
       character, it must be written first
              or last. Any character that does not have a defined
              special meaning inside a
       <code class="literal">
        []
       </code>
       pair
              matches only itself.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37885166"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'aXbc'</span><span class="token punctuation">,</span> <span class="token string">'[a-dXYZ]'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                 <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'aXbc'</span><span class="token punctuation">,</span> <span class="token string">'^[a-dXYZ]$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>               <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'aXbc'</span><span class="token punctuation">,</span> <span class="token string">'^[a-dXYZ]+$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>              <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'aXbc'</span><span class="token punctuation">,</span> <span class="token string">'^[^a-dXYZ]+$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>             <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'gheis'</span><span class="token punctuation">,</span> <span class="token string">'^[^a-dXYZ]+$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>            <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'gheisa'</span><span class="token punctuation">,</span> <span class="token string">'^[^a-dXYZ]+$'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>           <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        [=character_class=]
       </code>
      </p>
      <p>
       Within a bracket expression (written using
       <code class="literal">
        [
       </code>
       and
       <code class="literal">
        ]
       </code>
       ),
       <code class="literal">
        [=character_class=]
       </code>
       represents an
              equivalence class. It matches all characters with the same
              collation value, including itself. For example, if
       <code class="literal">
        o
       </code>
       and
       <code class="literal">
        (+)
       </code>
       are the
              members of an equivalence class,
       <code class="literal">
        [[=o=]]
       </code>
       ,
       <code class="literal">
        [[=(+)=]]
       </code>
       ,
              and
       <code class="literal">
        [o(+)]
       </code>
       are all synonymous. An
              equivalence class may not be used as an endpoint of a
              range.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        [:character_class:]
       </code>
      </p>
      <p>
       Within a bracket expression (written using
       <code class="literal">
        [
       </code>
       and
       <code class="literal">
        ]
       </code>
       ),
       <code class="literal">
        [:character_class:]
       </code>
       represents a
              character class that matches all characters belonging to
              that class. The following table lists the standard class
              names. These names stand for the character classes defined
              in the
       <code class="literal">
        ctype(3)
       </code>
       manual page. A
              particular locale may provide other class names. A
              character class may not be used as an endpoint of a range.
      </p>
      <div class="informaltable">
       <table summary="Character class names and the meaning of each class.">
        <colgroup>
         <col style="width: 20%"/>
         <col style="width: 80%"/>
        </colgroup>
        <thead>
         <tr>
          <th>
           Character Class Name
          </th>
          <th>
           Meaning
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           <code class="literal">
            alnum
           </code>
          </td>
          <td>
           Alphanumeric characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            alpha
           </code>
          </td>
          <td>
           Alphabetic characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            blank
           </code>
          </td>
          <td>
           Whitespace characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            cntrl
           </code>
          </td>
          <td>
           Control characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            digit
           </code>
          </td>
          <td>
           Digit characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            graph
           </code>
          </td>
          <td>
           Graphic characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            lower
           </code>
          </td>
          <td>
           Lowercase alphabetic characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            print
           </code>
          </td>
          <td>
           Graphic or space characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            punct
           </code>
          </td>
          <td>
           Punctuation characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            space
           </code>
          </td>
          <td>
           Space, tab, newline, and carriage return
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            upper
           </code>
          </td>
          <td>
           Uppercase alphabetic characters
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            xdigit
           </code>
          </td>
          <td>
           Hexadecimal digit characters
          </td>
         </tr>
        </tbody>
       </table>
      </div>
      <div class="informaltable">
       <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 431px; width: 709px;">
        <thead>
         <tr>
          <th style="width: 141.594px;">
           Character Class Name
          </th>
          <th style="width: 566.406px;">
           Meaning
          </th>
         </tr>
        </thead>
       </table>
      </div>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59116385"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'justalnums'</span><span class="token punctuation">,</span> <span class="token string">'[[:alnum:]]+'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>       <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'!!'</span><span class="token punctuation">,</span> <span class="token string">'[[:alnum:]]+'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>               <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span></code></pre>
      </div>
     </li>
    </ul>
   </div>
   <p>
    To use a literal instance of a special character in a regular
          expression, precede it by two backslash (\) characters. The
          MySQL parser interprets one of the backslashes, and the
          regular expression library interprets the other. For example,
          to match the string
    <code class="literal">
     1+2
    </code>
    that contains the
          special
    <code class="literal">
     +
    </code>
    character, only the last of the
          following regular expressions is the correct one:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94567478"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'1+2'</span><span class="token punctuation">,</span> <span class="token string">'1+2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                       <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'1+2'</span><span class="token punctuation">,</span> <span class="token string">'1\+2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                      <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">REGEXP_LIKE</span><span class="token punctuation">(</span><span class="token string">'1+2'</span><span class="token punctuation">,</span> <span class="token string">'1\\+2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                     <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token number">1</span></code></pre>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="regexp-resource-control">
       </a>
       Regular Expression Resource Control
      </h4>
     </div>
    </div>
   </div>
   <p>
    <a class="link" href="regexp.html#function_regexp-like">
     <code class="literal">
      REGEXP_LIKE()
     </code>
    </a>
    and similar
          functions use resources that can be controlled by setting
          system variables:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The match engine uses memory for its internal stack. To
              control the maximum available memory for the stack in
              bytes, set the
       <a class="link" href="server-system-variables.html#sysvar_regexp_stack_limit">
        <code class="literal">
         regexp_stack_limit
        </code>
       </a>
       system
              variable.
      </p>
     </li>
     <li class="listitem">
      <p>
       The match engine operates in steps. To control the maximum
              number of steps performed by the engine (and thus
              indirectly the execution time), set the
       <a class="link" href="server-system-variables.html#sysvar_regexp_time_limit">
        <code class="literal">
         regexp_time_limit
        </code>
       </a>
       system
              variable. Because this limit is expressed as number of
              steps, it affects execution time only indirectly.
              Typically, it is on the order of milliseconds.
      </p>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <br/>
</div>
