Hi currently I am having issue with Regex_Replace. I want to replace words in a sentence that matches a certain pattern and append some character behind it. For example the sentence contains the words "farm, farmer, farming, farmland" (words that starts with 'farm'). I wish to append 'abc' behind it to get "farmabc, farmerabc, farmingabc, farmlandabc". However seem like I am only able to search and replaced with fixed word like 'xxx' and not being able to refer to and make use of the current match.
Anyone have idea how to accomplish this?
An example to illustrate:
mySentence = "Bob is a farmer who likes to farm. He owns a farmland and do farming everyday."
By passing the variable "mySentence" into Regex_Replace method it should ideally returns:
"Bob is a farmerabc who likes to farmabc. He owns a farmlandabc and do farmingabc everyday."
https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/Text_API#Regex_Replace
Hello Jacky Koh,
I tried out a bunch of stuff and got to a solution.
I had to do a StringSlit() on your example and cycle the words to see if they matched the Regex and then assign the new value to each word and rebuild the string.
I´ will leave an oml attached so you can take a look at the code.
Hope it helps!
Paulo Rosário