in reply to Regex not working
Hi Raghu,
As davorg suggested it is always better to use the HTML Parsers to do these kind of stuffs. You have missed 's' option modifier. Also use qr to quote regular expressions instead of manually backslashing everything.
use strict; use warnings; my $content = "<div class='roundedBoxBody'><p> <table>sample table</table> <p> </p></p>"; my $x = qr{<div class='roundedBoxBody'><p>}; my $y = qr{<p> </p></p>}; my $content_out = $1 if ($content =~ m|$x(.*)$y|s); print $content_out;
Prasad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex not working
by davorg (Chancellor) on Jul 17, 2009 at 09:44 UTC |