In the search string you list the end ul tag doesn't show the / (</ul>) 
like you mention in the paragraph above it. Not sure if that was just a 
typo here or also in what you tried.

I don't think the regex approach is the best for this because it won't 
change all of them in one pass because of the multi-line matching. It would 
have to be run multiple times until it doesn't find a match.

My approach would be to open each file, highlight the entire ul from start 
to end and do a regex on the selection. If there are just too many files, 
then my second approach would be to use a Perl script that reads through 
the file until it finds the opening ul, then does li regex on each 
following line until it sees the end ul.

-Kendall


On Sunday, July 30, 2017 at 11:57:53 AM UTC-4, Dennis Chesters wrote:
>
> We have many HTML file with many special unordered lists <ul 
> class="container"> and want to change the <li> elements in just those lists 
> to <li class="vertical divider">.  So, this involves finding the multi-line 
> block of text constituting the list, and replacing the <li> tags.
>
> I tried grepping a list into 5 chunks: 1) the <ul 
> class="container"> string, 2) everything between the <ul> and the next 
> plain <li>, 3) the plain <li>, 4) everything between the <li> and the 
> closing </ul>, 5) the closing </ul>. 
>
> So, the FIND string looks like: (<ul 
> class="container">)((?s).*?)(<li>)((?s).*?)(<ul>)
> The round-parentheses delimit the 5 chunks, the .*? is a non-greedy string 
> match, and the (?s) flag includes carriage returns in the dot-everything 
> search.
> The intended REPLACE string looks like: \1\2<li 
> class="vertical-divider">\4\5
> This brackets the new middle (3rd) chunk with the original 1st+second and 
> 4th+5th chunk.
>
> However, the FIND selects everything to the end-of-file after the <ul 
> class="container">, despite the non-greedy (?s).*? syntax.
>
> How else to do this?
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to