Replacing isn't that difficult. The system expressions "Get right substring", "Get left substring" and "Get string length" will help you with it.
As a first exercise do this: Create a text box and create a private variable with the name word, the type text and the initial value fairy.
In the event sheet insert a "start of layout"-event. Create a sub-event using System - Compare.
In the first field enter right(Text.Value('word'), 1), comparison equal to, the second field should be "y".
Now create an action to this condition. Set the text of the text box to left(Text.Value('word'), len(Text.Value('word')) - 1) & "ies"
+ System: right(Text.Value('word'), 1) Equal to "y"
-> Text: Set text to left(Text.Value('word'), len(Text.Value('word')) - 1) & "ies"
[/code:uzzt57u4]
What is going on here is that you check if the last letter of the variable [i]word[/i] equals "y". right(text, count) returns the rightmost count letters of word. right("fairy", 1) returns "y", right("fairy", 2) would return "ry", etc.
In our case the condition becomes true and the action is performed. Here we retrieve the leftmost letters of [i]word[/i]. left("fairy", 1) would return "f", left("fairy", 2) returns "fa", etc. We just need to know the length of the word to get rid of the "y". len(Text.Value('word')) returns the number of letters in [i]word[/i]. We just need to substract 1 from the length ("y" is just one letter). Now [i]left(Text.Value('word'), len(Text.Value('word')) - 1)[/i] returns "fair" and we just need to add our new ending. "fair" & "ies" concatenates to "fairies".
Success!
You will most likely work with text, not just words. So you need to find a way to seperate the words of the text first and then use the above method. You will see that [i]GetToken(String, Index, Separator)[/i] is very helpful for that. For example, GetToken("I see fairy", 3, " ") will return "fairy", which you then could correct to "fairies", while rebuilding the text in a new variable or text box or whatever suits your needs.