[Chicago-talk] Need help on a parsing that used to work

Mike Pastore mike at oobak.org
Tue Nov 25 01:14:47 CST 2003


On second thought, stick with the regex. :-) Don't use split.

	Date: Tue, 25 Nov 2003 01:08:29 -0600

This would fail.

On Tue, 2003-11-25 at 01:08, Mike Pastore wrote:
> Bernie,
> 
> I'm surprised this ever worked, because the pattern will fail as soon as
> it hits the space between RCPT and FROM. Try this,
> 
> 	my ($field, $value) = /^([^:]+): (.*)$/;
> 
> Or better yet,
> 
> 	my ($field, $value) = split ': ';
> 
> >From what I understand about mail headers, you can always depend on that
> colon-space to be in the right place.
> 
> --
> Mike Pastore
> mike at oobak.org
> 
> On Mon, 2003-11-24 at 21:49, Bernie Leung wrote:
> > I have a strange Perl problem that I thought PM's can help. I have the
> > following PERL script that is acting strange (actually not working at
> > all) on Linux Perl5 (version 8 subversion 0), but is OK in Windows
> > Perl5 (version 8, suversion 1).
> > 
> > /^([^\s]+):(.*)$/
> > 
> > This is supposed to parse from $_ a line like 
> > 
> > RCPT FROM: bernie at mesatech.com
> > 
> > and spit out RCPT FROM: as $1   bernie at mesatech.com as $2.  This is
> > used throughout qmail-sanner-queue.pl which uses /usr/perl/suidperl.
> > 
> > It all seemed to have started happening Nov 16 (Sunday).
> > When suddenly it stopped working. I  know, nothing stops all of a
> > sudden by itself. But I surely can't find the answer. Does anyone have
> > any idea what is going on? Thanks for your help.
> > 
> > 
> > Bernie Leung
> >  
> > 
> > ______________________________________________________________________
> > _______________________________________________
> > Chicago-talk mailing list
> > Chicago-talk at mail.pm.org
> > http://mail.pm.org/mailman/listinfo/chicago-talk
> 
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk




More information about the Chicago-talk mailing list