I am trying to use regexp_replace in HIVE as a way to only keep certain words of a string.
I am trying to use the following:
select regexp_replace('I AM WANTING BLUE SHOES AND YELLOW STRINGS', '([^BLUE|SHOES|YELLOW|STRINGS])',' ')
But it is giving me "I W NTING BLUE SHOES N YELLOW STRINGS" instead of "BLUE SHOES YELLOW STRINGS"
I have tried using \b \s and any number of things to no avail. Any tips on getting this to work?
I also considered using regexp_replace but for my particular use case there are too many variables for it to be useful.