diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index ec51de9..00a1527 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -62,6 +62,7 @@ import sys
 
 # Handled test results.
 _VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ]
+_VALID_TEST_RESULTS_REX = re.compile("%s" % "|".join(_VALID_TEST_RESULTS))
 
 # Subdirectory of srcdir in which to find the manifest file.
 _MANIFEST_SUBDIR = 'contrib/testsuite-management'
@@ -202,7 +203,7 @@ def ValidBuildDirectory(builddir, target):
 
 def IsComment(line):
   """Return True if line is a comment."""
-  return line.startswith('#')
+  return bool(re.matches("#", line))
 
 
 def IsInterestingResult(line):
@@ -210,12 +211,12 @@ def IsInterestingResult(line):
   if '|' in line:
     (_, line) = line.split('|', 1)
     line = line.strip()
-  return any(line.startswith(result) for result in _VALID_TEST_RESULTS)
+  return bool(_VALID_TEST_RESULTS_REX.match(line))
 
 
 def IsInclude(line):
   """Return True if line is an include of another file."""
-  return line.startswith("@include ")
+  return bool(re.matches("@include ", line))
 
 
 def GetIncludeFile(line, includer):
@@ -227,7 +228,7 @@ def GetIncludeFile(line, includer):
 
 def IsNegativeResult(line):
   """Return True if line should be removed from the expected results."""
-  return line.startswith("@remove ")
+  return bool(re.matches("@remove ", line))
 
 
 def GetNegativeResult(line):
