I have a list of input-strings as follows: "PlusContent" "PlusArchieve" "PlusContent1" "PlusArchieve1"
and so on, meaning that there are allways two entries that build up a topic {content, archieve}. Now I want to get the number (let´s call it postfix) at the end of that string. For this aim I used the following regex:
Regex r = new Regex(@"Plus.+?(\d*)$", RegexOptions.IgnoreCase);
Now I loop the matches (should be up to 2, the first is the whole string, second one the actual match if existing).
foreach (Match m in r.Matches(tester)) Console.WriteLine(m);
where tester is the current string within my list. But as result I allways get the whole string, but not its postfix. I tested the same regex on regexHero and it worked...
Any ideas what´s going whrong?
P.S.: This is the whole code:
List<string> words = new List<string> { "PlusContent", "PlusArchieve", "PlusContent1", "PlusArchieve1" };
foreach(string tester in words) {
Regex r1 = new Regex(@"Plus.+?(\d*)$", RegexOptions.IgnoreCase);
foreach (Match m in r1.Matches(tester)) Console.WriteLine(m);
}
But for some strange reason I get only the original strings from within the list.