I have a situation where I’m wanting to see if 1 of 5 words are found in the input sentence. A Switch module seems the best option but I’m not sure if using a regular expression is meant for this scenario.
If the input sentence has “getting” (upper/lower case), then output purchased_gid.
If the input sentence has “uforward” (upper/lower case), then output purchased_uf.
Only one of the words would be found in the input sentence. So no checking for multiple instances.
Input → UForward Planner.
- → “getting” NOT found in sentence.
- → “uforward” found in sentence so output purchased_uf.
Would this be a job for Switch and regular expressions?
Yeah, you can use regular expressions in a switch statement. I need to test whether regex modifiers work with it or not, for eg, whether it supports case insensitive search or not, but I guess if it doesn’t then you can first convert the input to lowercase and perform.
What you want to do is, In the Pattern field use
.*getting.* and so forth for others. I haven’t tested it though, so just give it a try and see how it goes.
You’re right, I did need to keep the Lower() function on the input so the case sensitive matched. I used the .search_word. pattern on every switch statement and it worked beautifully.
This opens up a whole bunch of options, thank you.