Hi,

On May 14, 2007, at 11:50 PM, Tom Allison wrote:

yitzle wrote:
# Requires "by":
$line = "daffromHello Worldby";
$line =~ /from(.*)(by)/;
print $1;
Not sure about making it optional.
Can always check if you got "" and then try without the "by"

the .* pulls in too much.

I'm going to have to back up and try this again.
But I think it's late.

You can use '?' for the not greedy way

$line =~ m/
        from
        \s+
        (.*?) # anything, non greedy
        (?:
                \s+
                by
                \s+
                (.*)
        )?
$/smx;

Good luck!

--
Igor Sutton
[EMAIL PROTECTED]



Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to