From: Rafael Garcia-Suarez Date: Sun, 10 Aug 2003 13:30:11 +0000 (+0000) Subject: Further tweaks on perlreref.pod (by Iain Truskett) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e5a7b00343749c7d105ae604c729e7f14b9e23db;p=p5sagit%2Fp5-mst-13.2.git Further tweaks on perlreref.pod (by Iain Truskett) p4raw-id: //depot/perl@20594 --- diff --git a/pod/perlreref.pod b/pod/perlreref.pod index 8aad327..8d88681 100644 --- a/pod/perlreref.pod +++ b/pod/perlreref.pod @@ -11,7 +11,7 @@ as the L section in this document. =head1 OPERATORS =~ determines to which variable the regex is applied. - In its absence, C<$_> is used. + In its absence, $_ is used. $var =~ /foo/; @@ -26,39 +26,40 @@ as the L section in this document. x eXtended legibility - free whitespace and comments c don't reset pos on fails when using /g - If C is an empty string, the last I match - regex is used. Delimiters other than C may be used for both this + If 'pattern' is an empty string, the last I match + regex is used. Delimiters other than '/' may be used for both this operator and the following ones. qr/pattern/imsox lets you store a regex in a variable, - or pass one around. Modifiers as for C and are stored + or pass one around. Modifiers as for m// and are stored within the regex. s/pattern/replacement/igmsoxe substitutes matches of - C with C. Modifiers as for C - with addition of C: + 'pattern' with 'replacement'. Modifiers as for m// + with one addition: e Evaluate replacement as an expression 'e' may be specified multiple times. 'replacement' is interpreted as a double quoted string unless a single-quote (') is the delimiter. - ?pattern? is like C but matches only once. No alternate + ?pattern? is like m/pattern/ but matches only once. No alternate delimiters can be used. Must be reset with 'reset'. =head1 SYNTAX - \ Escapes the character(s) immediately following it - . Matches any single character except a newline (unless /s is used) - ^ Matches at the beginning of the string (or line, if /m is used) - $ Matches at the end of the string (or line, if /m is used) - * Matches the preceding element 0 or more times - + Matches the preceding element 1 or more times - ? Matches the preceding element 0 or 1 times - {...} Specifies a range of occurrences for the element preceding it - [...] Matches any one of the characters contained within the brackets - (...) Groups regular expressions - | Matches either the expression preceding or following it + \ Escapes the character(s) immediately following it + . Matches any single character except a newline (unless /s is used) + ^ Matches at the beginning of the string (or line, if /m is used) + $ Matches at the end of the string (or line, if /m is used) + * Matches the preceding element 0 or more times + + Matches the preceding element 1 or more times + ? Matches the preceding element 0 or 1 times + {...} Specifies a range of occurrences for the element preceding it + [...] Matches any one of the characters contained within the brackets + (...) Groups subexpressions for capturing to $1, $2... + (?:...) Groups subexpressions without capturing (cluster) + | Matches either the expression preceding or following it \1, \2 ... The text from the Nth group =head2 ESCAPE SEQUENCES @@ -165,7 +166,6 @@ Quantifiers are greedy by default --- match the B leftmost. =head2 EXTENDED CONSTRUCTS (?#text) A comment - (?:...) Cluster without capturing (?imxs-imsx:...) Enable/disable option (as per m//) (?=...) Zero-width positive lookahead assertion (?!...) Zero-width negative lookahead assertion @@ -174,7 +174,7 @@ Quantifiers are greedy by default --- match the B leftmost. (?>...) Grab what we can, prohibit backtracking (?{ code }) Embedded code, return value becomes $^R (??{ code }) Dynamic regex, return value used as regex - (?(cond)yes|no) cond being int corresponding to capturing parens + (?(cond)yes|no) cond being integer corresponding to capturing parens (?(cond)yes) or a lookaround/eval zero-width assertion =head1 VARIABLES @@ -279,6 +279,7 @@ David P.C. Wollmann, Richard Soderberg, Sean M. Burke, Tom Christiansen, +Jim Cromie, and Jeffrey Goff for useful advice.