BBEdit - replacing and with & character?

324 Views Asked by At

In BBEdit, how would I do replace all involving an ampersand.

So far, I replaced the & with and, but what if you really need to do it, what should be encased, not sure what would work.

This is my text:

<p>Simon and Garfunkel were an American folk-rock band.</p>

which should be:

<p>Simon & Garfunkel were an American folk-rock band.</p>

I can do search in selected text only, that's not the problem, it's how to replace and with an ampersand which is; I've done some light Google-ing but not sure how to figure this one out.

1

There are 1 best solutions below

0
On

If you have "Use Grep" turned on in the Find window, you'll need to escape the ampersand: use \&.

If you turn off "Use Grep", a simple ampersand will work fine.

Note that in both cases, since the destination is HTML, it's strongly advisable to use a character entity instead of a naked ampersand, i.e. &amp; for literal searches and \&amp; when Use Grep is turned on.

(More on searching and Grep in chapters 7 and 8 of the BBEdit user manual, on the Help menu.)