using REPLACE_PATTERN

Contains tips for configurators working with Aware IM
Post Reply
UnionSystems
Posts: 197
Joined: Fri Jun 17, 2016 7:10 am
Location: Brisbane Australia
Contact:

using REPLACE_PATTERN

Post by UnionSystems »

I'm a newbie to AwareIM but amazed by how much you can do with little effort. Aware IM really seems fantastic. I have however just struggled for 60 minutes trying to get REPLACE_PATTERN to work for me in a rule. I think I've discovered the following that might be useful for other newbies (please correct me if I'm wrong below!)

If you have a string and you want to swap elements of it using the REPLACE_PATTERN the following does not work :

Code: Select all

Person.ParsedString = REPLACE_PATTERN(Person.StoryTemplate,'ReplaceTheFirstName',Person.FirstName')
but this does work

Code: Select all

Person.ParsedString = REPLACE_PATTERN(Person.StoryTemplate,'ReplaceTheFirstName','<<Person.FirstName>>')
Also remember the second parameter of REPLACE_PATTERN respects regular expressions so if you put any special characters in it you need to escape them with a back slash. As per following to swap '{FirstName}'

Code: Select all

Person.ParsedString = REPLACE_PATTERN(Person.StoryTemplate,'\{FirstName\}','<<Person.FirstName>>')
AWS Linux, Windows Server, AIM 8.4 & 8.6
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: using REPLACE_PATTERN

Post by tford »

Did you try removing the unmatched ' at the end of Person.FirstName?
Person.ParsedString = REPLACE_PATTERN(Person.StoryTemplate,'ReplaceTheFirstName',Person.FirstName')
Tom - V8.8 build 3137 - MySql / PostGres
Post Reply