|
So I have the following Regular Expression:
Regex urlRegex = new Regex(@"(?<fullUrl>(?<scheme>http://|https://)(?<host>[a-z0-9.]*)(?<relativeMayFollow>/){0,1}(?(relativeMayFollow)(?<relativeUri>.*|)))");
Attempting to generate a string that matches this throws the following exception:
Regex parse error at index 87: Backref must begin with ' or <.
Naturally, index 87 is the end of the above red text in my regular expression.
Now, this is a legal .NET RegEx named-group conditional that states "if the group named 'relativeMayFollow' was matched, then try to match .*, else match nothing.
Any idea on how I can still express the above in a form that TestApi will accept?
Thanks!
Matt
|