fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. string input = "select ceiling(a.interest) as interest, a.myID as mID, a.studentID as sID from mytable";
  9. string column = "a.myID";
  10. string pattern = "((?<=\\bselect)\\s+[^,]*\\b" + Regex.Escape(column) + "\\b[^,]*\\s*,?|\\s*,\\s*[^,]*\\b" + Regex.Escape(column) + "\\b[^,]*(?=(?:,|\\sfrom\\b)))";
  11. string output = Regex.Replace(input, pattern, "", RegexOptions.IgnoreCase);
  12. Console.WriteLine(output);
  13. }
  14. }
Success #stdin #stdout 0.08s 37224KB
stdin
Standard input is empty
stdout
select ceiling(a.interest) as interest, a.studentID as sID from mytable