Re: String Replace Backwards


Flo
 

On Wed, Jul 29, 2020 at 03:33 PM, Axel Berger wrote:
Is there any way to transfer ^!Replace ", " >> " \& " HBSTI to working on a variable?
this is about the last comma in a list of authors.
The last comma in a list followed by a space is matched with ',\s\Z'.

Try...

^!Set %Authors%="XXX^PYYY^PZZZ, "
^!Info ^%Authors%
^!Set %Authors%=^$StrReplace(",\s\Z";"";"^%Authors%";R)$
^!Info ^%Authors%

This is using the new ^$StrReplace$ that was added in NT 7.0.

Regards,
Flo

Join Clips@Notetab.groups.io to automatically receive all group messages.