This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlretut: Clarify metacharacters
authorKarl Williamson <khw@cpan.org>
Wed, 27 Dec 2017 00:20:38 +0000 (17:20 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 23 Feb 2018 18:36:44 +0000 (11:36 -0700)
pod/perlretut.pod

index 2f7670e..3add259 100644 (file)
@@ -170,10 +170,16 @@ always match at the earliest possible point in the string:
 
 With respect to character matching, there are a few more points you
 need to know about.   First of all, not all characters can be used "as
-is" in a match.  Some characters, called I<metacharacters>, are reserved
-for use in regexp notation.  The metacharacters are
+is" in a match.  Some characters, called I<metacharacters>, are
+generally reserved for use in regexp notation.  The metacharacters are
 
-    {}[]()^$.|*+?-\
+    {}[]()^$.|*+?-#\
+
+This list is not as definitive as it may appear (or be claimed to be in
+other documentation).  For example, C<"#"> is a metacharacter only when
+the C</x> pattern modifier (described below) is used, and both C<"}">
+and C<"]"> are metacharacters only when paired with opening C<"{"> or
+C<"["> respectively; other gotchas apply.
 
 The significance of each of these will be explained
 in the rest of the tutorial, but for now, it is important only to know