[sf-perl] don't understand regexp behavior

David Alban extasia at extasia.org
Mon Oct 1 11:34:18 PDT 2007


i've got a file with one line:

  $ cat ~/junk2
  //foo/bar/bat.c#42 delete

  $ od -c ~/junk2
  0000000   /   /   f   o   o   /   b   a   r   /   b   a   t   .   c   #
  0000020   4   2       d   e   l   e   t   e  \n
  0000032

and i get:

  $ perl -ne 'm{ \A ( [^\#]+ \# \d+ ) \s+ \S+ }xms and print' ~/junk2
  //foo/bar/bat.c#42 delete

  $ perl -ne 'm{ \A ( [^\#]+ \# \d+ ) \s+ \S+ \z }xms and print' ~/junk2

the second invocation prints nothing.

what am i missing?  i would expect both patterns to match.  i actually
want to use the second pattern because words like 'delete', 'add',
'edit' will be last on each line of input.

  This is perl, v5.8.5 built for i386-linux-thread-multi

thanks,
david
-- 
Live in a world of your own, but always welcome visitors.


More information about the SanFrancisco-pm mailing list