私は専門家ではありませんが、SQLコメント行を除外するために.NET正規表現を記述しようとしています。残念ながら、除外グループを使用して別の正規表現の一致で正規表現の一致を見つける方法の適切な説明を見つけることができません:('。*?')。
この正規表現は、引用符で囲まれたすべてのテキストを検索しますが、SQLコメント領域(/*..*/および-..)も含まれます。
'.*?'
私が試したすべてが期待どおりに機能しません。
私のテストサンプル:
IF @RetValue = 'Cat'
/*SET @RetValue = 'WrongLocation
and it works here' */
------testing line
SET @Dude = 'Punto'
/* comments */
-- But it doesn't work here because inside comments!
-- and this is aren't the end
SET @RetValue = 'But this should
work here'
正しい一致はこれだけを返す必要があります:
'Cat'
''Punto'
and
'But this should
work here'