CSharp · Console
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
public class Program
{
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}");
Console.Write(output);
}
}