I have a directory with some C # files. In these files there are several SQL query codes.
I need to list all SELECT statements in these files using PowerShell.
Commands start with SELECT
and end with ;
and can have more than one line, as an example:
SQL = "SELECT t.a, t.b, t.c FROM uf_GetResultSet(4, 1, 0, 0, 'G', 0, 0, 0) t";
(...)
SQL = "SELECT t.a, t.b, t.c" +
"FROM uf_GetResultSet(4, 3, 0, 0, 'C', " + idSomeThing.ToString() + ", 0, 0) t";
The default regex SELECT .+[\r\n]*.+";
fits me perfectly using Notepad ++, but I do not know how to adapt it in PS.