Hello,
I am having problems with an optional group in a regex (.NET syntax, and I'm using RegexOptions.Singleline).
"function (\w*).*?{(?:.*?\((.*?)\))?.*?}"
Also tried, to no avail:
"function (\w*)[^{]+{(?:.*?\((.*?)\))?.*?}"
It looks like the group is not optional, because if I just add two parenthesis in FunctionWithNoParameters then all is working fine. The goal is to have two groups: the function name and their optional parameters. Can someone help me?
The text I'm trying to parse is something like:
function test1
{
param ([int]$parm2, [bool]$parm3)
}
function FunctionWithNoParameters {
return "nothing"
}
function test2 {
param([string]$parm1,
[int]$parm2,
[bool]$parm3)}
Thanks, Alex