Need to match "key(...)" or "key (...)" but only capture "...":
key(abc) //abc captured
key (def) //def captured
But non-fixed length look behind is forbidden, so use another non-capture group after look behind this:
(?<=key)(?:[ ]{0,1}\().+?(?=\))
But space and ( before "..." is still captured too. Doesn't non-capture mean "not captured"?
So I tried this most simple case about non capturing group:
(?:abc)def
still capture the whole abcdef, on reg101 and in C#.
The reason may be some complex concepts called captures and groups, but after try:
Regex r = new Regex("(?:abc)def");
foreach(var c in r.Match("abcdef").Captures)...
foreach(var g in r.Match("abcdef").Groups)...
foreach(var c in r.Match("abcdef").Groups[0].Captures)...
still only get abcdef...