Hi Chris, I just noticed that you too use T-E+. I sing the praises of it every day and it's a big reason I'm still at Mojave, the last 32-bit compatible version of the OS. I wonder what happened to Tom Bender, the guy behind it. I've found no answer on Google. Cheers, Duncan
On Wednesday, May 26, 2021 at 4:30:08 PM UTC-6 [email protected] wrote: > On 05/25/2021, at 23:19, Duncan Thorne <[email protected]> wrote: > > Here's a sample line from my script where things go wrong: > > *tell* *front* *text window's* *text* > > *replace* "2021 > > \$" using " \$" options {search mode:*grep*, case sensitive:*false*, > starting at top:*true*} -- the idea being to take out a line break and > replace it with a tab. > > *end* *tell* > > ------------------------------ > > Hey Duncan, > > Backslash is the escape character in AppleScript, so when you need to > write it as a literal you have to *escape* the escape character. > > *set* myDollarSign *to* "\\$" > > I *know* this is often quite confusing to neophyte AppleScripters, so > please forgive me for forgetting to mention it explicitly. > > For future references here's how you'd write the regular expression > in AppleScript: > > *tell* *application* "BBEdit" > *tell* *front* *document* > *replace* "(2021)\\n(\\$)" using "\\1\\t\\2" options {search mode: > *grep*, case sensitive:*false*, starting at top:*true*} > *end* *tell* > *end* *tell* > > If you take the literal strings (between the quotes) and replace the "\\" > with "\" as a literal string in BBEdit you'll get unescaped version > that BBEdit wants. > > A perhaps simpler trick to see the literal string is to copy it to the > clipboard like so: > > *set the clipboard to* "(2021)\\n(\\$)" > > --> (2021)\n(\$) > > The part after “--> ” is the pasted result. > > “--> ” is a writing convention for indicating the result of an AppleScript. > > I too am a long time user of Tex-Edit Plus and will sorely miss it down > the road. > > > -- > Best Regards, > Chris > > -- 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/9b1f60e2-998b-47c1-90d7-eabfbf036248n%40googlegroups.com.
