Paul <[EMAIL PROTECTED]> sez: >Two full days of experimenting, reading, expermenting, researching, >experimenting and I can't figure out how to get this done. > >I want to find and replace blocks like the following, using the ><div ... /div> tags as delimiters. The problem seems to be that the >number of paragraphs varies. ... [example elided]
Here's one way to do this; with the "Grep" option on, search for: <div.*?>((?s).+?)</div> replace with: \1 [ to remove the divs and leave only their content; you can season this part to taste :-) ] and here's how it works: We start off by matching the literal text "<div" of the opening tag, then add .* to match zero or more additional characters within the tag [i.e. to match the tag whether or not it has attributes], and ? to keep this match from being 'greedy', then use a literal ">" to end it. Next, we use .+? to do a non-greedy match of all the content inside the div open and close tags. Pre-pending (?s) allows . to match line breaks [by default, it doesn't], and we then wrap this part of the expression in parentheses to make it a re-usable subpattern. Finally, we end the pattern with the literal text "</div>" to match the closing tag. In the replace expression, we use \1 to insert the contents of the first (and in this case, only) subpattern match, which is everything within the div tag. Regards, Patrick Woolsey == Bare Bones Software, Inc. <http://www.barebones.com> P.O. Box 1048, Bedford, MA 01730-1048 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to bbedit@googlegroups.com 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 specific feature request or would like to report a suspected (or confirmed) problem with the software, please email to "[EMAIL PROTECTED]" rather than posting to the group. -~----------~----~----~----~------~----~------~--~---