At 11:17 -0700 20/10/11, dp wrote:
I need to find and replace everything between and including the
delimiters
<!-- Begin value list -->
and
<!-- End value list -->
The text to be replaced includes returns. Early attempts with (.*)
found only the opening delimiter and the next line, stopped by the
return at the end of the second line. Attempts to get past the returns
using (?s).+ ignore the closing delimiter and swallow the remainder of
the document.
If you are doing your substitutions line by line then a text filter
like this will do it:
#! /usr/bin/perl
use strict;
my $on;
while (<>) {
$on = 1 and print and next if /<!-- Begin value list -->/;
$on = 0 if /<!-- End value list -->/;
if ($on) { # actions when switched on
s/.+/*****$&*****/;
}
print;
}
__END__
If you need to cross over line endings then the solution is a little different.
JD
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>