0

I want to find a pattern to match SQL Server columns like this

"select c1,c2,c3,(select c4,(select c5 from t2) c7 from t1) a1, from t3 "

Is that possible to match the whole strings between first "select" and last "from"

Is there somebody who can help me?

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
  • SQL is not a nice language to have to parse with regexes. You can easily run into nasty corner cases that won't work. Consider using the [`TSqlParser`](https://docs.microsoft.com/dotnet/api/microsoft.sqlserver.transactsql.scriptdom.tsqlparser) classes (from [here](https://www.nuget.org/packages/Microsoft.SqlServer.TransactSql.ScriptDom/)), they were specifically made to do this. – Jeroen Mostert Aug 24 '18 at 09:57
  • I get one pattern like this,select(((?!select|from).)*((? – wenqi.wang Aug 24 '18 at 10:02

0 Answers0