I need to parse string that looks like in example below:
Regex TitleRegex = new Regex(@"[A-Z].* - ([0-9].*) [A-Z]");
var match = TitleRegex.Match("Chapter - 1 The Brown Fox");
Console.WriteLine(match.Groups[1].Value);
What I want is to extract a number. The problem is that output is 1 The Brown
instead of simply 1
.
I do not understand why letters are also included to the numeric ([0-9]
) pattern.
Any suggestions?