Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Suggested Answer
Replies
10 replies
Answers
1 answer
Subscribers
10 subscribers
Views
7365 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Substitute multiple words in one go
erick258
over 7 years ago
Hi,
Is there a way to substitute multiple word in a string in one go? e.g. I have a string "Quick brown fox jumps over the lazy dog", I want to substitute the "brown", "fox" and "dog" into "black", "dog" and "sheep" respectively hence the sentence turn into "Quick black dog jumps over the lazy sheep".
P.S. the number of replacements can be different depends on the case.
Thanks
OriginalPostID-268847
Discussion posts and replies are publicly visible
Top Replies
Stefan Helzle
over 7 years ago
+1
A Score Level 3
You can use reduce() to do this. =with( local!text: "Quick brown fox jumps over the lazy dog", reduce( substitute( _,_,_ ), local!text, merge( {"brown", "fox", "dog"}, {"black", "dog", "sheep"} ) ) )
Mike Schmitt
over 7 years ago
+1
I wrote myself a custom expression rule to do something similar to what @stefan posted - i called it "multipleSubstitute" - see attached. Multi Substitute.sail
Harshit Bumb (Appyzie)
10 months ago
in reply to
Sudharsan S
+1
Certified Lead Developer
This is a 7-year-old post..!!
Parents
0
PhilB
A Score Level 1
over 7 years ago
@stefan Probably don't need partial evaluation there :)
Another option is, if you have the regex plugin installed, to use reduce with fnr!egexreplaceall(), but that might be overkill here.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
PhilB
A Score Level 1
over 7 years ago
@stefan Probably don't need partial evaluation there :)
Another option is, if you have the regex plugin installed, to use reduce with fnr!egexreplaceall(), but that might be overkill here.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data