diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-02-13 18:44:35 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-02-15 18:02:34 -0700 |
commit | 736fe711926e145fd5999cb7df97cd35279ddc53 (patch) | |
tree | f2b27d666c006401bb694624bfdda7bae5ee808f | |
parent | 4cd6899110c0316028f08dd4692f66595f314fc3 (diff) | |
download | perl-736fe711926e145fd5999cb7df97cd35279ddc53.tar.gz |
Clarify some quotemeta docs
-rw-r--r-- | pod/perlop.pod | 6 | ||||
-rw-r--r-- | pod/perlre.pod | 2 | ||||
-rw-r--r-- | pod/perlrebackslash.pod | 16 |
3 files changed, 17 insertions, 7 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index 1e6f94e8e3..1cb186a7a7 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1501,10 +1501,14 @@ X<\l> X<\u> X<\L> X<\U> X<\E> X<\Q> X<\F> \L lowercase all characters till \E or end of string \U uppercase all characters till \E or end of string \F foldcase all characters till \E or end of string - \Q quote non-word characters till \E or end of string + \Q quote (disable) pattern metacharacters till \E or + end of string \E end either case modification or quoted section (whichever was last seen) +See L<perlfunc/quotemeta> for the exact definition of characters that +are quoted by C<\Q>. + C<\L>, C<\U>, C<\F>, and C<\Q> can stack, in which case you need one C<\E> for each. For example: diff --git a/pod/perlre.pod b/pod/perlre.pod index 1a0581bc97..772a8bc418 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -920,6 +920,8 @@ backslash interpolation may lead to confusing results. If you I<need> to use literal backslashes within C<\Q...\E>, consult L<perlop/"Gory details of parsing quoted constructs">. +C<quotemeta()> and C<\Q> are fully described in L<perlfunc/quotemeta>. + =head2 Extended Patterns Perl also defines a consistent extension syntax for features not diff --git a/pod/perlrebackslash.pod b/pod/perlrebackslash.pod index 98435e5b8c..f81af0c6dd 100644 --- a/pod/perlrebackslash.pod +++ b/pod/perlrebackslash.pod @@ -90,7 +90,8 @@ as C<Not in [].> \o{} Octal escape sequence. \p{}, \pP Character with the given Unicode property. \P{}, \PP Character without the given Unicode property. - \Q Quotemeta till \E. Not in []. + \Q Quote (disable) pattern metacharacters till \E. Not + in []. \r Return character. \R Generic new line. Not in []. \s Character class for whitespace. @@ -331,11 +332,14 @@ them, until either the end of the pattern or the next occurrence of C<\E>, whichever comes first. They provide functionality similar to what the functions C<lc> and C<uc> provide. -C<\Q> is used to escape all characters following, up to the next C<\E> -or the end of the pattern. C<\Q> adds a backslash to any character that -isn't a letter, digit, or underscore. This ensures that any character -between C<\Q> and C<\E> shall be matched literally, not interpreted -as a metacharacter by the regex engine. +C<\Q> is used to quote (disable) pattern metacharacters, up to the next +C<\E> or the end of the pattern. C<\Q> adds a backslash to any character +that could have special meaning to Perl. In the ASCII range, it quotes +every character that isn't a letter, digit, or underscore. See +L<perlfunc/quotemeta> for details on what gets quoted for non-ASCII +code points. Using this ensures that any character between C<\Q> and +C<\E> will be matched literally, not interpreted as a metacharacter by +the regex engine. C<\F> can be used to casefold all characters following, up to the next C<\E> or the end of the pattern. It provides the functionality similar to |