Skip to content

Commit

Permalink
Reversed Stream to ensure proper replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
raynichc committed Apr 5, 2020
1 parent 4a3a63c commit 09d68bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/ibdiscord/utils/UInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static boolean isValidRegex(String regex) {
*/
public static String escapeLinebreakInQuotations(String input) {
StringBuilder string = new StringBuilder(input);
QUOTATION.matcher(string.toString()).results().forEach(matchResult ->
QUOTATION.matcher(string.toString()).results().sorted((m1, m2) -> m2.end() - m1.end()).forEach(matchResult ->
string.replace(matchResult.start(), matchResult.end(),
matchResult.group().replaceAll("\n", "\\\\n")));
return string.toString();
Expand Down

0 comments on commit 09d68bf

Please sign in to comment.