So, you have:
number out of number
A number is a sequence of digits, with at least one digit:
Regex digit:
\d
At least one:
+
Now you my want to extract these two numbers:
(\d+)
Putting all together (C#):
string pattern = @"(\d+) out of (\d+)";
Getting all matches in the whole text (C#):
string fullText = ...;
string pattern = @"(\d+) out of (\d+)";
int all = 0;
int sick = 0;
int count = 0;
foreach(var match in Regex.Matches(fullText, pattern).Cast<Match>())
{
sick += int.Parse(match.Group[1].Value);
all += int.Parse(match.Group[2].Value);
count++;
}
Console.WriteLine("From {0} classes, {1}% are sick",
count, all > 0 ? sick / all : 0);
Cheers
Andi