Hi,
I'm trying to parse a Powershell script for its functions and parameters. I am almost there, byt I am having troubles with newlines. The expression parses test2 to test6 fine but with test1 I cannot get it to work.
I could of course specify my clients do not use the first syntax, but there must be a way. Can someone point me in the right direction? FWIW: I'm using this in C#.
The regex I'm using is: "function (\w*)\s*\{\s*param\((.*)\)\s*}
"
content testfile.ps1:
function test1 {
param([string]$parm1, [int]$parm2,
[bool]$parm3)}
function test2
{
param([int]$parm2, [bool]$parm3)
}
function test3
{ param(blabla3)}
function test4 { param(blabla4) }
function test5 {param(blabla5)}
function test6{param(blabla6)}
Thanks, Alex