I the following code in my google sheets apps script file. I want to match all strings that match '10.10.23 ' followed by any word except 'No' and 'Skip'. So the expected results are:
Expected Output: 10.10.23 Yes, 10.10.23 Need this, 10.10.23 wanted
Should not show these: second 10.10.23 No, 10.10.23 Skip paras
function TestRegex(){
var data = "first 10.10.23 Yes\nsecond 10.10.23 No\n\n10.10.23 Skip paras\n10.10.23 Need this 10.10.23 wanted";
var regexPattern = `\\b10\\.10\\.23\\b\\ *(?!.*(No|Skip)\\b)\\w+/g`;
var regExp = new RegExp(regexPattern, "gi"); // "gi" global & case-insensitive
var result = regExp.exec(data);
Logger.log(`result: ${result}`);
Logger.log(`result.Length: ${result.length()}`);
}
I tried almost every way with no results. It seems like there is no lookback in regex of RE2, so any workaround to do this? Also, please provide any link to test the regex online that will work with google sheets apps script.