string test = "select * from testtable where id in(select id form table where tid=1)";
string _where = Regex.Replace(test, @"\ where\ ", " where (", RegexOptions.IgnoreCase | RegexOptions.Compiled);
我要得到的结果是 select * from testtable where (id in(select id form table where tid=1)
也就是说遇到的第一个where要替换成 where ( 应该怎么写那个正则啊?
string test = "select * from testtable where id in(select id form table where tid=1)";
Regex regex = new Regex(" where ", RegexOptions.IgnoreCase);
string _where = regex.Replace(test, " where (", 1);