using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
string strValue = "OFFSET NUMBER ROWS";
string strIndex = "5";
strValue = Regex.Replace(strValue , @"(?<=OFFSET\s*)\w+(?=\s*ROWS)", strIndex);
Console.WriteLine(strValue);
Console.WriteLine(Regex.Replace(strValue , @"(OFFSET\s*)\w+(\s*ROWS)", $"${{1}}{strIndex}$2"));
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CnB1YmxpYyBjbGFzcyBUZXN0CnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKCXsKCQkgc3RyaW5nIHN0clZhbHVlID0gIk9GRlNFVCBOVU1CRVIgUk9XUyI7CgkJIHN0cmluZyBzdHJJbmRleCA9ICI1IjsKCQkgc3RyVmFsdWUgID0gUmVnZXguUmVwbGFjZShzdHJWYWx1ZSAsIEAiKD88PU9GRlNFVFxzKilcdysoPz1ccypST1dTKSIsIHN0ckluZGV4KTsKCQkgQ29uc29sZS5Xcml0ZUxpbmUoc3RyVmFsdWUpOwoJCSBDb25zb2xlLldyaXRlTGluZShSZWdleC5SZXBsYWNlKHN0clZhbHVlICwgQCIoT0ZGU0VUXHMqKVx3KyhccypST1dTKSIsICQiJHt7MX19e3N0ckluZGV4fSQyIikpOwoJfQp9