Fix issue #254
diff --git a/R/group_rows.R b/R/group_rows.R
index f6f0d43..4ac5654 100644
--- a/R/group_rows.R
+++ b/R/group_rows.R
@@ -186,7 +186,9 @@
                       regex_escape(extra_latex_after, double_backslash = TRUE))
   }
   new_rowtext <- paste0(pre_rowtext, rowtext)
-  out <- sub(rowtext, new_rowtext, out)
+  out <- sub(paste0(rowtext, "\\\\\\\\\n"),
+  	         paste0(new_rowtext, "\\\\\\\\\n"),
+  	         out)
   out <- gsub("\\\\addlinespace\n", "", out)
   out <- structure(out, format = "latex", class = "knitr_kable")
   table_info$group_rows_used <- TRUE