How to replace words based on keywords in the example

sugaroosugaroo Member Posts: 1 Newbie
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!


  • Options
    kaymankayman Member Posts: 662 Unicorn
    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. 
Sign In or Register to comment.