in reply to Re: Matching text between tags
in thread Matching text between tags

Sorry, it matches, but only the first <u>...</u> There are two lines in the sample text.
foreach my $lines (@lines){ if( $lines =~ /<u>(.*?)<\/u>/igs ){ print "\n $1\n"; } }

Replies are listed 'Best First'.
Re^3: Matching text between tags
by LanX (Saint) on Apr 14, 2016 at 16:10 UTC
    Did you try what I suggested?

    if has scalar context and will only match once per line!

    The /g will only memorize the position fur the consecutive match.

    (i.e. two ifs will match twice and so on)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!