Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: how to express $temp =~ s/.*?from://; in perl 4

by Anonymous Monk
on Jul 30, 2000 at 22:26 UTC ( [id://25174] : note . print w/replies, xml ) Need Help??


in reply to how to express $temp =~ s/.*?from://; in perl 4

Use a negated character class:
$temp = "notfrom:nowhere"; # Match zero or more non-f characters followed by "from:" $temp =~ s/[^f]*from://; print "$temp\n";
Prints "nowhere".

Replies are listed 'Best First'.
RE: Re: how to express $temp =~ s/.*?from://; in perl 4
by merlyn (Sage) on Jul 30, 2000 at 22:32 UTC
    That's not the same as finding the nearest match:
    $text = "fanny farmer from: big sky";
    There's no trivial way to say "a string of text that doesn't contain FROM" in Perl 4 regex. There are many wrong ways that people attempt. :)

    -- Randal L. Schwartz, Perl hacker