Perfect! Thank you, Jean.
Literally learning something new (about AppleScript) every day,
))Sonic((
On Thursday, October 7, 2021 at 10:38:48 PM UTC-7 jj wrote:
> Sonic,
>
> You don't need to use grep substitutions in replacement expressions.
>
> set StoryTitle to "Example Story"
> set ConcatStoryTitle to "ExampleStory"
> tell application "BBEdit"
> tell text document 1
> set vRegex to "(\\d\\d?)(.+?)</a>"
> set vReplacement to "<li><a href=\"" & ConcatStoryTitle &
> "\\1.html\" title=\"" & StoryTitle & " chapter \\1: \\2\">\\2</a>"
> replace vRegex using vReplacement searching in it options {search
> mode:grep, wrap around:true}
> end tell
> end tell
>
> HTH
>
> Jean Jourdain
>
> On Friday, October 8, 2021 at 6:40:37 AM UTC+2 [email protected] wrote:
>
>> Forgot to mention: if the following block is inserted in place of the
>> *replace*, it works:
>>
>> *find* "(\\d\\d?)(.+?)</a>" options {search mode:*grep*, wrap around:
>> *true*} *with* selecting match
>>
>> *set* chapnumtest *to* *grep substitution* of ("\\1" *as* *text*)
>>
>> *set* chaptitletest *to* *grep substitution* of ("\\2" *as* *text*)
>>
>> *log* chapnumtest
>>
>> *log* chaptitletest
>>
>>
>> So this tells me that my Grep string is valid (which i know from it
>> working with the manual not scripted Replace All), making it all the more
>> puzzling to me why it fails in a scripted *replace* (all).
>>
>
--
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/4cb80a1b-80d8-481a-917c-9048ca507dffn%40googlegroups.com.