@@ -584,10 +584,32 @@ the meantime, here's a quick cheat sheet:
584
584
^ start of string
585
585
$ end of string
586
586
587
- Quantifiers can be used to specify how many of the previous thing you
588
- want to match on, where "thing" means either a literal character, one
589
- of the metacharacters listed above, or a group of characters or
590
- metacharacters in parentheses.
587
+ Note that in the above, C<$> doesn't match a dollar sign. Similarly
588
+ C<.>, C<\>, C<[>, C<]>, C<(>, C<)>, and C<^> don't match the characters
589
+ you might expect. These are called "metacharacters". In contrast, the
590
+ characters C<a>, C<e>, C<i>, C<o>, and C<u>, for example, are not
591
+ metacharacters. They match themselves literally. Metacharacters
592
+ normally match something that isn't their literal value. There are a few
593
+ more metacharacters than the ones above. Some quantifier ones are
594
+ given below, and the full list is in L<perlre/Metacharacters>.
595
+
596
+ To make a metacharacter match its literal value, you "escape" (or "quote")
597
+ it, by preceding it with a backslash. Hence, C<\$> does match a dollar sign,
598
+ and C<\\> matches a literal backslash.
599
+
600
+ Note also that above, the string C<\s>, for example, doesn't match a
601
+ backslash followed by the letter C<s>. In this case, preceding the
602
+ non-metacharacter C<s> with a backslash turns it into something that
603
+ doesn't match its literal value. Such a sequence is called an "escape
604
+ sequence". L<perlrebackslash> documents all of the current ones.
605
+
606
+ A warning is raised if you escape a character that isn't a metacharacter
607
+ and isn't part of a currently defined escape sequence.
608
+
609
+ You can specify how many of the previous thing you want to match on by
610
+ using quantifiers (where "thing" means one of: a literal character, one
611
+ of the constructs listed above, or a group of either of them in
612
+ parentheses).
591
613
592
614
* zero or more of the previous thing
593
615
+ one or more of the previous thing
0 commit comments