描述
正则表达式:^(.*?)TableOne[.]@ColumnTwo,\s+(.*?)[@](.*?)$
替换为:\1\2\3
例子
这是添加的 C# 示例以显示正则表达式的工作原理。
using System;
using System.Text.RegularExpressions;
namespace myapp
{
class Class1
{
static void Main(string[] args)
{
String sourcestring = "SELECT TableOne.ColumnOne, TableOne.@ColumnTwo, TableOne.ColumnThree FROM TableOne WHERE TableOne.@ColumnTwo ='abc'";
String matchpattern = @"^(.*?)TableOne[.]@ColumnTwo,\s+(.*?)[@](.*?)$";
String replacementpattern = @"\1\2\3";
Console.WriteLine(Regex.Replace(sourcestring,matchpattern,replacementpattern,RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline));
}
}
}
$sourcestring after replacement:
SELECT TableOne.ColumnOne, TableOne.ColumnThree FROM TableOne WHERE TableOne.ColumnTwo ='abc'