Scenario:
Match match = Regex.Match("abc", "(?(?=x)bx)");
Console.WriteLine("Success: {0}", match.Success);
Console.WriteLine("Value: \"{0}\"", match.Value);
Console.WriteLine("Index: {0}", match.Index);
Output:
Success: True
Value: ""
Index: 1
Expected result:
I don't know. If leaving out the "else" expression isn't supported, it should throw an exception. Otherwise, matching anywhere seems the most reasonable option. In any case, if the condition fails, the result should not depend on the contents of the "if" expression.
Additional notes:
https://stackoverflow.com/q/48574288/785745