In Appian, write a expression to remove every "AB" from each string, wherever it appears
Example:
Input: {"ABHello", "HelloABWorld", "WorldAB", "ABCABD"}Output: {"Hello", "HelloWorld", "World", "CD"}Each value starts with "AB", and the goal is to remove this prefix from every string.
In Appian, write a expression to remove every "AB" from each string, wherever it appears
Example:
Each value starts with "AB", and the goal is to remove this prefix from every string.
Answer
Solution 1: substitute()
substitute(text, find, replace_with) swaps part of a string for another string, and the Appian community points to it as the replace-all equivalent.
It is case sensitive, so "ab" stays. Substitution is also a single pass: "AABB" becomes "AB", because the AB that forms after the first removal isn’t removed.
Solution 2: regex
regexreplaceall comes from Appian’s free Regex Functions plug-in and isn’t built in. It replaces all matches of a pattern in the input string.
To remove every AB:
The pattern changes with where AB may appear:
Solution 3: split and join
Split the string on "AB", then join the pieces back together with nothing between them.
Output:

Which one to use
substitute() is my default for removing exact text anywhere. Regex fits when the rule is a pattern, such as “only at the start or end” or “any two letters,” and the cost is installing the plug-in. In an interview, I’d give substitute() first, then show regex with the ^AB|AB$ pattern to show you can control position.
Try it yourself
Change the inputs or the expression and run it to see what it returns.
Independent evaluator: it approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms