in reply to Extracting Text After <pre> tag in HTML
## OP specified 'last <pre>' tag, ## so assume there can be more than one <pre>..</pre> block ## find all <pre> blocks, using non-greedy .*? and also ## get \n in the case where the html ends with a newline and no </pre> ## anchor to non-capturing match for closing </pre> or end of string my @pre = ( $VAR1 =~ m{<pre>(.*?\n?)(?:</pre>|$)}isg ); ## we want the last one my $new_output = pop @pre;
|
|---|