Regular expression examples: Difference between revisions

Content deleted Content added
Explained why [.\n] doesn't match any character
Line 11:
<tr>
<td>'''.'''</td>
<td>Matches an arbitrary character, but not a newline. It is important to note that when placed inside square brackets ([.]), the dot becomes a literal period, meaning it will only match the '.' charater. You can confirm this with the expression /[.\n]{5}/, which, at first glance, appears to look for any five characters, new line or otherwise. In truth, it is equivalent to /[\.\n]{5}/. Instead of [.\n], use (.|\n) or a character class like [\s\S].</td>
<td>Matches an arbitrary character, but not a newline.</td>
<td align="left">
<pre>