fix #303

Ensures that when duplicated rows are detected the correct line is replaced by sub.

Add's the same regex pattern to add_indent _latex for detecting lines that end in \\, \\*, \\[...] and \\*[...].
diff --git a/R/add_indent.R b/R/add_indent.R
index 35cc196..44ea7cd 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -48,8 +48,8 @@
 
   for (i in positions + table_info$position_offset) {
     rowtext <- table_info$contents[i]
-    out <- sub(paste0(rowtext, "\\\\\\\\\n"),
-               paste0(latex_indent_unit(rowtext), "\\\\\\\\\n"),
+    out <- sub(paste0(rowtext, "(\\\\\\\\\\*?(\\[.*\\])?\n)"),
+               paste0(latex_indent_unit(rowtext), "\\1"),
                out, perl = TRUE)
     table_info$contents[i] <- latex_indent_unit(rowtext)
   }
diff --git a/R/util.R b/R/util.R
index 6e174d7..efe13bc 100644
--- a/R/util.R
+++ b/R/util.R
@@ -129,7 +129,11 @@
     new_row <- str_replace(
       dup_row, "(?<=\\s)([\\S]+[\\s]*)$",
       paste0("\\\\\\\\vphantom\\\\{", empty_times, "\\\\} \\1"))
-    kable_input <- sub(dup_row, new_row, kable_input)
+    kable_input <- sub(
+      paste0(dup_row, "(?=\\s*\\\\\\\\\\*?(\\[.*\\])?)"),
+      new_row,
+      kable_input,
+      perl = TRUE)
     table_info$contents[i] <- new_row
   }
   table_info$duplicated_rows <- FALSE