On Oct 20, 2:15 pm, John Delacour <[email protected]> wrote: > 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
Both my needs and my knowledge are much simpler. The value list master is kept in a single file. The value list is used in six places in other files. The delimiters bracket each place where it is used. When the value list changes, I change the master, copy the master, and replace each instance in the other files. I can drop the master into the Replace field of the Find/Replace window. I'm just trying to develop a search string that will allow me to find the delimiters and everything in between, so that I can replace all instances at once, rather than individually. -- 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>
