Front page | perl.perl5.porters |
Postings from April 2000
Revised candidate for perlrequick.pod
From:
Mark Kvale
Date:
April 17, 2000 10:24
Subject:
Revised candidate for perlrequick.pod
Message ID:
200004171724.e3HHO4q04206@phy.ucsf.edu
Here is the revised candidate for perlrequick.pod, a quick start guide
for Perl regexps. The patch against the original is below, or if you
would rather download the new version, it can be found at
http://keck.ucsf.edu/~kvale/perlrequick.pod
I'd like to thank Brad Hughes and Ilya Zakharevich for helpful comments.
-Mark
ivy 110% diff -c perlrequick.pod.orig perlrequick.pod
*** perlrequick.pod.orig Mon Apr 17 10:08:14 2000
--- perlrequick.pod Mon Apr 17 10:19:19 2000
***************
*** 47,53 ****
"Hello World" =~ m!World!; # matches, delimited by '!'
"Hello World" =~ m{World}; # matches, note the matching '{}'
! "/usr/bin/perl" =~ m"/perl"; # matches, '/' becomes ordinary char
Regexps must match a part of the string I<exactly> in order for the
statement to be true:
--- 47,54 ----
"Hello World" =~ m!World!; # matches, delimited by '!'
"Hello World" =~ m{World}; # matches, note the matching '{}'
! "/usr/bin/perl" =~ m"/perl"; # matches after '/usr/bin',
! # '/' becomes an ordinary char
Regexps must match a part of the string I<exactly> in order for the
statement to be true:
***************
*** 91,97 ****
$foo = 'house';
'cathouse' =~ /cat$foo/; # matches
- 'housecat' =~ /$foocat/; # doesn't match, there is no $foocat
'housecat' =~ /${foo}cat/; # matches
With all of the regexps above, if the regexp matched anywhere in the
--- 92,97 ----
***************
*** 113,121 ****
Character classes are denoted by brackets C<[...]>, with the set of
characters to be possibly matched inside. Here are some examples:
! /cat/; # matches 'cat'
! /[bcr]at/; # matches 'bat, 'cat', or 'rat'
! "abc" =~ /[cab/; # matches 'a'
In the last statement, even though C<'c'> is the first character in
the class, the earliest point at which the regexp can match is C<'a'>.
--- 113,121 ----
Character classes are denoted by brackets C<[...]>, with the set of
characters to be possibly matched inside. Here are some examples:
! /cat/; # matches 'cat'
! /[bcr]at/; # matches 'bat, 'cat', or 'rat'
! "abc" =~ /[cab]/; # matches 'a'
In the last statement, even though C<'c'> is the first character in
the class, the earliest point at which the regexp can match is C<'a'>.
-
Revised candidate for perlrequick.pod
by Mark Kvale