diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index cfd928f6e28a0f04d160a811f079a12aed6342f4..73621a0bdbdc3fd7091d734cbfbb7f26760a4c96 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -297,7 +297,7 @@ proc _get_lines { filename first_line last_line } {
 
 # Convert $multiline from a list of strings to a multiline regex
 # We need to support matching arbitrary followup text on each line,
-# to deal with comments containing containing DejaGnu directives.
+# to deal with comments containing DejaGnu directives.
 
 proc _build_multiline_regex { multiline index } {
     verbose "_build_multiline_regex: $multiline $index" 4
@@ -307,7 +307,10 @@ proc _build_multiline_regex { multiline index } {
 	verbose "  line: $line" 4
 
 	# We need to escape "^" and other regexp metacharacters.
-	set line [string map {"^" "\\^"
+	set line [string map {"\{re:" "("
+	                      ":re?\}" ")?"
+	                      ":re\}" ")"
+	                      "^" "\\^"
 	                      "(" "\\("
 	                      ")" "\\)"
 	                      "[" "\\["