X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlre.pod;h=37434a67e75b57034aca6e476ad6f5489c1a0b76;hb=84850974f570c6c594cc0df54611ffc5f0b26130;hp=f881a3bcc778ad206ed8e638056b13a0a744af3c;hpb=4a6725af9146bd7faaa10aa5429ff009d393fd6d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlre.pod b/pod/perlre.pod index f881a3b..37434a6 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -163,7 +163,7 @@ Perl defines the following zero-width assertions: \B Match a non-(word boundary) \A Match at only beginning of string \Z Match at only end of string (or before newline at the end) - \G Match only where previous m//g left off + \G Match only where previous m//g left off (works only with /g) A word boundary (C<\b>) is defined as a spot between two characters that has a C<\w> on one side of it and a C<\W> on the other side of it (in @@ -173,9 +173,10 @@ represents backspace rather than a word boundary.) The C<\A> and C<\Z> are just like "^" and "$" except that they won't match multiple times when the C modifier is used, while "^" and "$" will match at every internal line boundary. To match the actual end of the string, not ignoring newline, -you can use C<\Z(?!\n)>. The C<\G> assertion can be used to mix global -matches (using C) and non-global ones, as described in +you can use C<\Z(?!\n)>. The C<\G> assertion can be used to chain global +matches (using C), as described in L. + It is also useful when writing C-like scanners, when you have several regexps which you want to match against consequent substrings of your string, see the previous reference. @@ -514,7 +515,11 @@ in C<[]>, which will match any one of the characters in the list. If the first character after the "[" is "^", the class matches any character not in the list. Within a list, the "-" character is used to specify a range, so that C represents all the characters between "a" and "z", -inclusive. +inclusive. If you want "-" itself to be a member of a class, put it +at the start or end of the list, or escape it with a backslash. (The +following all specify the same class of three characters: C<[-az]>, +C<[az-]>, and C<[a\-z]>. All are different from C<[a-z]>, which +specifies a class containing twenty-six characters.) Characters may be specified using a metacharacter syntax much like that used in C: "\n" matches a newline, "\t" a tab, "\r" a carriage return, @@ -572,3 +577,7 @@ You can't disambiguate that by saying C<\{1}000>, whereas you can fix it with C<${1}000>. Basically, the operation of interpolation should not be confused with the operation of matching a backreference. Certainly they mean two different things on the I side of the C. + +=head2 SEE ALSO + +"Mastering Regular Expressions" (see L) by Jeffrey Friedl.