Community & Support
Learn
Marketplace
Discussions
Categories
Discussions
General
Platform
Academic
Partner
Regional
User Groups
Documentation
Events
Altair Exchange
Share or Download Projects
Resources
News & Instructions
Programs
YouTube
Employee Resources
This tab can be seen by employees only. Please do not share these resources externally.
Groups
Join a User Group
Support
Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
How to replace words based on keywords in the example
sugaroo
I wish to replace words in an example if ever it contains a keyword. In my case, any example that contains the word "street" must be replaced by "village". So if the example contains "Elmo street" then it will be replaced into "village" thanks!
Find more posts tagged with
AI Studio
Accepted answers
All comments
kayman
You can use regex combined with the replace operator.
In this specific case it can be as simple as looking for street, and replacing it by village.
Of course, this can be tricky if you have words that contain street, so you may need to use boundaries.
For instance, using street\b means that street only should be replaced if it's at the end of a word (so followed by a space, a dot or whatever that's not a character)
You can do this with a single word, or with a list of words. In the latter case ordering is very important to avoid unwanted replacements.
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups