Although this is the BBEdit forum, I would recommend good 'ol "sed" from
the command line for this job. Something like this should work:

sed '/<a href/ s/:/\&amp;/g' <old.html >new.html

to do it on all files in the working directory:
find . -name '*.txt' -exec sed -i '' '/<a href/ s/:/\&amp;/g' "{}" \;

Or, less cryptic, open the file in vim. Here, the same command would be
:/<a href/ s/:/\&amp;/g

These examples replace every ":" with "&amp;" only on lines that contain
"<a href" (assuming, that patterns identifies the lines you are looking for
- please adapt). And of course: try this on copies first - no guarantee,
that command does not wreak havoc upon your files :-)

To bring this back to BBEdit: It would be a nice addition if BBEdit's
search window would someday get an additional "only search lines matching a
pattern" functionality :-)

Roland

On Sat, Oct 7, 2017 at 12:05 AM, Lee Hinde <leehi...@gmail.com> wrote:

> I've taken over a project and have many many html files with strings like
> this:
>
> <a href="/catalogView.html?4;24;1::::::::::Page=1;Bran=512033">
>
> I want to change all occurrences of a semi-colon within a url to something
> else, like &amp;.
>
> I started with this search string:
>
> (href=\".*);(.*\"[ ,>])
>
> and this replacement string:
>
> \1\&amp;\2
>
> The problem is it is only replacing one of the semi-colons (and oddly, to
> me, not the first one) and I'd like to replace all of them.
>
> Pointers would be appreciated.
>
> --
> 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.
>

-- 
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