Fix #464
diff --git a/R/collapse_rows.R b/R/collapse_rows.R
index b837194..5491529 100644
--- a/R/collapse_rows.R
+++ b/R/collapse_rows.R
@@ -238,7 +238,7 @@
       )
       new_contents[i] <- paste0(new_contents[i], "\\\\\\\\\n", row_midrule)
     }
-    out <- sub(contents[i + 1], new_contents[i], out)
+    out <- sub(contents[i + 1], new_contents[i], out, perl=TRUE)
   }
   out <- gsub("\\\\addlinespace\n", "", out)