Validating a file with regular expressions