[tpm] Regex question
Emil Janev
ejanev at gmail.com
Tue Nov 6 10:55:44 PST 2007
Hi Indy,
Instead of:
while ($x =~ s//(^|$)foo.*?\n//gs) {1;}
I tried:
$x =~ s/(^|$)foo.*?\n//mgs;
and it gives the same result.
Regards,
Emil
On Nov 6, 2007 1:39 PM, Indy Singh <indy at indigostar.com> wrote:
> Hello all,
>
> I have some multiline data as shown below. I want to remove all
> occurances of 'foo.*?' that are at the beginning of a line. How can I
> do that witha regex. I can do it with a while loop, but is a there a
> more elegent way with a single regex? Perhaps using some look ahead or
> look behind assertion.
>
>
> $x='foo one
> foo two
> other foo three
> more stuff
> ';
> print "x=$x";
> while ($x =~ s//(^|$)foo.*?\n//gs) {1;}
> print "x=$x";
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
--
Emil Janev
More information about the toronto-pm
mailing list