c#中,如何用正则表达式匹配sql语句where之前的部分? 5
c#中,为什么下面的正则表达式匹配出的结果是0(要求配出sql语句where之前部分)?若下面正则表达式去掉行首^符号,返回“elect*fromOilTankerMea...
c#中,为什么下面的正则表达式匹配出的结果是0(要求配出sql语句where之前部分)?若下面正则表达式去掉行首^符号,返回“elect * from OilTankerMeasureGrid” ,字符串行首字母s没了
new Regex(@"^[\s\S]+(?=(W|w)(H|h)(E|e)(R|r)(E|e))").Matches("select * from OilTankerMeasureGrid where Product='油品prodet' And MeasureTime between CONVERT(datetime,'2019/8/26 0:00:00',101) And CONVERT(datetime,'2019/8/29 0:00:00',101) And WaterHeight=90 ", 1) 展开
new Regex(@"^[\s\S]+(?=(W|w)(H|h)(E|e)(R|r)(E|e))").Matches("select * from OilTankerMeasureGrid where Product='油品prodet' And MeasureTime between CONVERT(datetime,'2019/8/26 0:00:00',101) And CONVERT(datetime,'2019/8/29 0:00:00',101) And WaterHeight=90 ", 1) 展开
2个回答
展开全部
foreach(Match m in new Regex(@"^(?:\s*)(.+)(?=(?i:where))").Matches("select * from OilTankerMeasureGrid where Product='油品prodet' And MeasureTime between CONVERT(datetime,'2019/8/26 0:00:00',101) And CONVERT(datetime,'2019/8/29 0:00:00',101) And WaterHeight=90 "))
{
Console.WriteLine(m.Value);
}
{
Console.WriteLine(m.Value);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询