Closed RealRaven2000 closed 4 months ago
Here is a test version:
I am using this in my current sale campaign for QuickFolders in order to inject a percent sign into the subject line, example:
%header.prefix(subject,"🐇 QuickFolders Frühlingsangebot - erneuern und 25% sparen - ")%
To install version above download zip file and drag the file into Thunderbird Add-ons Manager (do not extract contents, it won't install like that)
I did a number of tweaks to the regular expression for recognizing the various smarttemplates patterns from both simple to complex. There major challenges with allowing the "%" character and matching everything within the parentheses (including parentheses for other regular expressions). The goal is that only a combination of )%
within the parameter list would break the regex:
%from%
To: "%to(name)%"<%to("( %",mail)%>
%matchTextFromBody("(domainname|domain) = (\w*@){0,1}((?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11})")%
%header.set(subject,"some text with 100%")%
(there were some problems with matching the correct 1st opening parenthesis after the smarttempaltes keyword(s). I think they are addressed now by adding a ?
instead of *
after the second parts (0 or one instance, with a nongreedy lookahead within the second argument (\(.+?\))?
). The final pattern is:
%([a-zA-Z][\w\-:=.]*)(\(.+?\))?%
To install version above download zip file and drag the file into Thunderbird Add-ons Manager (do not extract contents, it won't install like that)
Implemented in 4.5 released on 14/05/2024
at the moment variables fail when a %-sign is used within the parameters list. This is caused by the current regular expression that is used to recognize the contents of the parameters; see smartTemplate-overlay.js:4236
The reason I used
[^%]
was that it avoided making the last match of*\))*%
(a closing parenthesis followed by %) too greedy. Now I found the following replacement, using.+?
- apparently this matches any characters, but as few as possible.