I created a small sample project called Sentence Tester. As you can see at the pictures, it creates dynamically event sentences. Keywords will replaced by the values of the event, if they are not empty.
There are conditional keywords. This is the structure: <prefix [keyword] suffix>. The prefix and the suffix are optional. The string should only printed, if the value is not empty. On the second picture you can see, the year will not printed correctly. Why?
Replacement patterns are not part of the PCRE engine so each vendor designs their own way of doing it. In this case, Xojo uses both “” and “$” to reference subgroups, and the difference is, “” didn’t work the way you wanted and “$” did.