summaryrefslogtreecommitdiff
path: root/devdocs/elisp/regular-expressions.html
blob: 02a98e0b60f0a99acfb43020baf455bd01f8ed3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 <h3 class="section">Regular Expressions</h3>   <p>A <em>regular expression</em>, or <em>regexp</em> for short, is a pattern that denotes a (possibly infinite) set of strings. Searching for matches for a regexp is a very powerful operation. This section explains how to write regexps; the following section says how to search for them. </p>   <p>For interactive development of regular expressions, you can use the <kbd>M-x re-builder</kbd> command. It provides a convenient interface for creating regular expressions, by giving immediate visual feedback in a separate buffer. As you edit the regexp, all its matches in the target buffer are highlighted. Each parenthesized sub-expression of the regexp is shown in a distinct face, which makes it easier to verify even very complex regexps. </p> <p>Note that by default Emacs search ignores case (see <a href="searching-and-case">Searching and Case</a>). To enable case-sensitive regexp search and match, bind <code>case-fold-search</code> to <code>nil</code> around the code you want to be case-sensitive. </p> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="syntax-of-regexps" accesskey="1">Syntax of Regexps</a>
</td>
<td> </td>
<td align="left" valign="top">Rules for writing regular expressions. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="regexp-example" accesskey="2">Regexp Example</a>
</td>
<td> </td>
<td align="left" valign="top">Illustrates regular expression syntax. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="rx-notation" accesskey="3">Rx Notation</a>
</td>
<td> </td>
<td align="left" valign="top">An alternative, structured regexp notation. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="regexp-functions" accesskey="4">Regexp Functions</a>
</td>
<td> </td>
<td align="left" valign="top">Functions for operating on regular expressions. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="regexp-problems" accesskey="5">Regexp Problems</a>
</td>
<td> </td>
<td align="left" valign="top">Some problems and how they may be avoided. </td>
</tr> </table><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Regular-Expressions.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Regular-Expressions.html</a>
  </p>
</div>