in reply to multi line matching problem
That should output:my $string = <<ENDSTRING; <thing> condition condition condition condition randomness other junk </thing> ENDSTRING print "$string\n"; $string =~ s{ <thing>.*?</thing> } {<THANG>blah</THANG>}msx; print "$string\n";
<thing>
condition condition
condition condition
randomness
other junk
</thing>
<THANG>blah</THANG>
I'd recommend reading the "matching within multiple lines"
recipe in the Perl Cookbook (that's recipe 6.6 in both the 1st and 2nd editions).
And by the way... you're not rolling your own code to parse HTML or XML are you? You should be looking for already existing modules out on CPAN.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: multi line matching problem
by jcpunk (Friar) on Dec 16, 2003 at 08:33 UTC | |
by chanio (Priest) on Dec 16, 2003 at 14:48 UTC | |
by jcpunk (Friar) on Dec 18, 2003 at 02:19 UTC |