I have some data that looks like this:
:setvar DatabaseName "CI_1814903104"
:setvar DefaultFilePrefix "CI_1814903104"
--etc.
GO
I wish to replace all sql cmd variable lines (lines that start with :setvar) with an empty string such that the data looks like this:
--etc.
GO
This statement (where $script
contains the data) seems to do the trick but still leaves the newlines:
$script -replace ":setvar(.*$)", ""
results in:
--etc.
GO
How do I include the newline in the match? It seems to match it but not actually be replaced. Any help appreciated.