use strict;
my $str = ' <div align="justify">
<table width="552" border="0">
<tr>
<td><h1 class="article" itemprop="name">Modals</h1></td>
</tr>
<tr>
<td class="text_dreapta">On February 25, 2011, in <a href="modals.html" title="View all articles from Modals" class="external" rel="category tag">Destiny</a>, by Roland Worrior</td>
</tr>
</table>
<p class="text_obisnuit2"><em>Should I stay or should I go?</em></p>
<p class="oyric"> Laurie Strode comes to her final confrontation with Michael Myers, the masked figure who has haunted her since she narrowly escaped. </p>';
my $regex = qr/(?s)(\G|<p class="oyric">)((?!</p>).)*?\K((?<=>)\h+|\h+(?=<|\h))/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html