Shaveta_Chawla has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on extract a substring between two emements

Replies are listed 'Best First'.
Re: extract a substring between two emements
by Anonymous Monk on Oct 10, 2011 at 07:04 UTC
Re: extract a substring between two emements
by exilepanda (Friar) on Oct 10, 2011 at 07:00 UTC
    $line =~ m/href="([^"]+.pdf)"/i;

    Is that what you want ?

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: extract a substring between two emements
by AnomalousMonk (Archbishop) on Oct 10, 2011 at 14:32 UTC
    >perl -wMstrict -le "my $line = 'Hello hello START this is comment END ' . 'START this is still comment END ' . 'START this should still be comment END ' . 'this is fixed' ; ;; my $START = qr{ START \s* \K }xms; my $END = qr{ (?= \s* END) }xms; my $not_end = qr{ (?! $END) . }xms; ;; my ($extract) = $line =~ m{ $START $not_end* should $not_end* $END }xmsg; print qq{[[$line]]}; print qq{'$extract'}; " [[Hello hello START this is comment END START this is still comment END START this should still be comment END this is fixed]] 'this should still be comment'