输入字符串1 得出字符串2
1条回答 默认 最新
- SecretGarden 2018-03-31 13:33关注
以下为C#代码,已测试通过:
string pattern = @"(select[\s]+[\S]+)[\s]+(from[\s\S]+)[\s]+(order[\s\S]*)"; Regex regex = new Regex(pattern, RegexOptions.None); string source = @"select * from jx_mingxi1 where id>0 order by id"; string target = @"select * from ($1, ROW_NUMBER()over($3) as num $2) as t where t.num>=@start and t.num<=@end"; return regex.Replace(source, target);
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报