I'm new to .NET and having a hard time trying to understand the Regex
object.
What I'm trying to do is below. It's pseudo-code; I don't know the actual code that makes this work:
string pattern = ...; // has multiple groups using the Regex syntax <groupName>
if (new Regex(pattern).Apply(inputString).HasMatches)
{
var matches = new Regex(pattern).Apply(inputString).Matches;
return new DecomposedUrl()
{
Scheme = matches["scheme"].Value,
Address = matches["address"].Value,
Port = Int.Parse(matches["address"].Value),
Path = matches["path"].Value,
};
}
What do I need to change to make this code work?