Background: I need to match a multiline pattern(?) in a C# source file. The regular expression will be manipulate by Powershell. I have tested and it works on RegexBuddy (with the Dot Matches newline". But when I try to use it via powershell, it does not work.
Regex:
[\s]*(?!\/)\[Role.*?\].*?\(.*?\).*?;
C# Code:
[Role (MethodName ="param")]
void doSomething(Param1 Param2);
Powershell code:
$FunctionPattern="^[\s]*(?!\/)\[Role.*?\].*?\(.*?\).*?;"
$FunctionMatch =[regex]::matches($Data,$FunctionPattern)
$FunctionMatch | format-table index,length,value -auto
According to this, for Powershell to use multiline, I have to use the contruct (?m) but this does not work
Help and thanks in advance!! (Opps I cannot use grep/dedicated parsers/ and findstr does not to multiline without a hacl etc hence the need for Powershell)