using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
Regex r = new Regex(@"Select TOP (?<t>\d+)(?<q>.*?order by[ a-z]+)");
string input = "Select TOP 2 * from customer order by id desc";
string output = r.Replace(input, "Select ${q} LIMIT ${t}");