title: How to handle Regex with multiple patterns?
body: <p>I have a requirement where I need to read a query from access db and modify the query to replace all the keywords in the query to SQL executable query..
  For eg: say there is a query 'Select key from table1"</p>
  
  <p>here "key" is a reserved keyword.which has to be modified as "Select [key] from table1" (which will work in sql).</p>
  
  <p>there is a possibility that the query can have multiple keywords..so I have a regex as below.</p>
  
  <pre><code>string pattern = "Key|IN|ON|VIEW]";
  Regex rgx = new Regex(pattern);
  </code></pre>
  
  <p>I have the below code..which checks for the patterns..</p>
  
  <pre><code>string pattern = "Key|IN|ON|VIEW]";
  Regex rgx = new Regex(pattern);  
  string strModifiedQuery = string.Empty;
  strModifiedQuery = strQueryText;
  foreach (Match m in rgx.Matches(pattern))
  {
      Console.WriteLine(m.Value);
      if (m.Value == "Key")
      {
          strModifiedQuery = rgx.Replace(strModifiedQuery, "[Key]");
      }
  
      if (m.Value == "IN")
      {
          strModifiedQuery = rgx.Replace(strModifiedQuery, "[IN]");
      }
  
      if (m.Value == "ON")
      {
          strModifiedQuery = rgx.Replace(strModifiedQuery, "[IN]");
      }
  </code></pre>
  
  <p>Is there a better way in c# to replace the matched pattern with a proper value?</p>