On 26 Oct 2021, at 21:58, Sonic Purity wrote:

*Issue*: when replacing HTML which contains &amp: using the BBEdit *replace* command in an AppleScript, the placeholder text being replaced is included at each
occurrence of & in the replacement text, surrounded by the (desired)
replacement text.

That's because you've specified a Grep search, in which "&" in the replacement string specifies expansion of the entire match when calculating the replacement. Chapter 8 of the user manual will have details.

There's no need to specify "search mode: grep" unless you specifically plan to perform regular expression pattern matching(*) in your search or replacement; and as you've just demonstrated, unnecessarily specifying "search mode: grep" can cause unexpected side effects. :-)

(* NB: backslash single-character escapes (such as \", \n, \t and so forth) do not require grep searching.)

R.

--
Rich Siegel                                 Bare Bones Software, Inc.
<[email protected]>                      <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "[email protected]" rather than posting here. 
Follow @bbedit on Twitter: <https://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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/ABE19A82-1227-40B9-AEBE-33E5DD04C78C%40barebones.com.

Reply via email to