I am using Snowflake database and hope to find a single expression that will find and replace multiple items. The column in question has rows containing, Y, Yes, N, NO, and other irrelevant strings. So, in the example below Y and Yes are replaced with TRUE, N and No are replaced with FALSE and the other strings remain as they are. I have wasted TOO much time on this. Any help is MOST appreciated!
dog
Yes
No
Y
N
Zip
This works: REGEXP_REPLACE(REGEXP_REPLACE(VALUE,'^y(es)$','TRUE',1,0,'i'),'^n(o)$','FALSE',1,0,'i') but I hope to reduce it to a single expression because there are other needed replacements and I hope to avoid numerous functions in functions...
This does not work, but I think it shows the goal: REGEXP_REPLACE(VALUE,'(y(es)?)|(N(o)?)','$1TRUE$2FALSE',1,0,'i')
https://en.wikipedia.org/wiki/Regular_expression#POSIX_basic_and_extended