If you want to account for whitespace, use \s* or \s+ as appropriate. (Also, raw strings, r"...", make life a bit easier with the escaping.)