I have a query where I replace all the keywords specified in the pattern with the keyword enclosed in square brackets.
if my query already has Select [key] from table1, I should ignore and avoid replacing it:
var pattern = @"(?i)Key|IN|ON|VIEW";
var subject = "Select key from table1";
var result = Regex.Replace(subject, pattern, @"[$0]");
How to achieve this?