This should work (edited to ignore the white space at the beginning of the line)
int i = int.Parse(Regex.Match("26 things", @"^\s*(\d+)").Groups[1].Value);
If you are worried about checking for a value, you can do the following to give you a value of -1 if there is no integer at the beginning of the line.
Match oMatch = Regex.Match("26 things", @"^\s*(\d+)"); int i = oMatch.Success ? int.Parse(oMatch.Groups[1].Value) : -1;
source share