[CMI.PM] String matching sanity check?

Mitch Kutzko mitch at ncsa.uiuc.edu
Wed May 25 15:08:21 PDT 2005


>Take out the backslashes before the parentheses -- it's not necessary as 
>the parentheses are already special grouping characters.

Now, I've discovered several continued lines.  Any suggestions on how to
handle things like this cleanly:

  Subject: DAST: Iperf - read failed: Connection refused -
    luca.seoli at aliceposta.it
  Mime-Version: 1.0

(I want to check for an email address anywhere between the Subject: line
and the next "real" line, the Mime-Version: line.)


Theoretically, this:

  #!/usr/bin/perl -p0777i.old
  s/Subject: (.*)@(.*)Mime-Version:/Subject: \1 --at-- \2Mime-Version:/s;
 
or this:

  #!/usr/bin/perl -p0777i.old
  s/Subject: (.*)@(.*)Mime-Version:/Subject: \1 --at-- \2Mime-Version:/m;


should work, right?  But I'm clearly not understanding something correctly,
because they don't work. 

The -p0777 says to look at the whole file, not just line-by-line, so why is
this not matching?

Thanks,

Mitch
--
Mitch Kutzko | mitch at dast.nlanr.net | mitch at ncsa.uiuc.edu | 217-333-1199
Project: http://dast.nlanr.net/  |  Personal: http://hobbes.ncsa.uiuc.edu/


More information about the Champaign-Urbana mailing list