diff --git a/gcc/testsuite/lib/old-dejagnu.exp b/gcc/testsuite/lib/old-dejagnu.exp
index 156b60eb55a751444d98fa1edc020c3025de12b4..66337639955e1b37346391531bebaf0400f3a45a 100644
--- a/gcc/testsuite/lib/old-dejagnu.exp
+++ b/gcc/testsuite/lib/old-dejagnu.exp
@@ -526,7 +526,7 @@ proc old-dejagnu { compiler prog name cflagsx default_cflags libs } {
 
     #look to see if this is all thats left, if so, all messages have been handled
     #send_user "comp_output: $comp_output\n"
-    regsub -all "(^|\n)\[^\n\]*: In (.*function|method|.*structor) \[^\n\]*" $comp_output "" comp_output
+    regsub -all "(^|\n)\[^\n\]*: In (\[^\n\]*function|method|\[^\n\]*structor) \[^\n\]*" $comp_output "" comp_output
     regsub -all "(^|\n)\[^\n\]*: In instantiation of \[^\n\]*" $comp_output "" comp_output
     regsub -all "(^|\n)\[^\n\]*:   instantiated from \[^\n\]*" $comp_output "" comp_output
     regsub -all "(^|\n)\[^\n\]*: At (top level|global scope):\[^\n\]*" $comp_output "" comp_output