I have one issue with REGEXEXTRACT in Google Sheet. I want to match and extract the exact word. If I use the below formula, it will display the result “Sing,” but I want it to display “NA.” Because the source cell i.e A1 cell does not have the “Sing” word but it has the word "Singapore". =regexextract(A1,”(?i)Sing”) So, how can we extract the exact match instead of the partial match? Thanks & Regards, Vineet
CodePudding user response:
REGEXEXTRACT is going to extract the part of the string that matches your regex expression. What you need to use is REGEXMATCH which returns a TRUE or FALSE and use it as a condition for IF:
=IF(REGEXMATCH(A1,(?i)Sing”), A1,"")
CodePudding user response:
use:
=IF(REGEXMATCH(A1; "\b(?i)sing\b"); A1; "NA")
(?i) case insensitive
\b boundary