develooper Front page | perl.perl5.porters | Postings from August 2003

Re: [doc] perlreref - a regular expression quick reference

Thread Previous | Thread Next
From:
Iain Truskett
Date:
August 10, 2003 07:32
Subject:
Re: [doc] perlreref - a regular expression quick reference
Message ID:
20030810143218.GF7914@gytha.anu.edu.au
* Rafael Garcia-Suarez (rgarciasuarez@free.fr) [10 Aug 2003 23:51]:

[...]
> Thanks, added to bleadperl as change #20593.
> (I know that I will be going to use it.)

Excellent!

I did get some comments offlist and changed the version at the URL
given. Patch follows:

--- pod/perlreref.pod	2003-08-10 23:47:27.000000000 +1000
+++ pod/perlreref.pod.new	2003-08-11 00:31:00.000000000 +1000
@@ -1,3 +1,4 @@
+
 =head1 NAME
 
 perlreref - Perl Regular Expressions Reference
@@ -11,7 +12,7 @@
 =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 +27,40 @@
         x  eXtended legibility - free whitespace and comments
         c  don't reset pos on fails when using /g
 
-     If C<pattern> is an empty string, the last I<successfully> match
-     regex is used. Delimiters other than C</> may be used for both this
+     If 'pattern' is an empty string, the last I<successfully> 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<m//> 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<pattern> with C<replacement>. Modifiers as for C<m//>
-     with addition of C<e>:
+     '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<m/pattern/> 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 +167,6 @@
 =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 +175,7 @@
    (?>...)          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
@@ -207,7 +208,7 @@
    uc          Uppercase a string
    ucfirst     Titlecase first char of a string
    pos         Return or set current match position
-   quotemeta   Quote metacharacters
+   quotemeta   Quote meta characters
    reset       Reset ?pattern? status
    study       Analyze string for optimizing matching
 
@@ -268,7 +269,7 @@
 =item *
 
 I<Mastering Regular Expressions> by Jeffrey Friedl
-(F<http://regex.info/>) for a thorough grounding and
+(L<http://regex.info/>) for a thorough grounding and
 reference on the topic.
 
 =back
@@ -279,6 +280,8 @@
 Richard Soderberg,
 Sean M. Burke,
 Tom Christiansen,
+Jim Cromie,
 and
 Jeffrey Goff
 for useful advice.
+

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About