From 0b418caf401c53eb73721a324cd13041c185d0fb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 22 Jan 2019 20:52:52 +0300 Subject: Fix quote regex --- src/main/java/com/juick/util/MessageUtils.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/juick/util') diff --git a/src/main/java/com/juick/util/MessageUtils.java b/src/main/java/com/juick/util/MessageUtils.java index 5cc8bb97..72c9bd04 100644 --- a/src/main/java/com/juick/util/MessageUtils.java +++ b/src/main/java/com/juick/util/MessageUtils.java @@ -87,7 +87,7 @@ public class MessageUtils { private final static String underlineRegex = "((?<=\\s)|(?<=\\A))_([^\\_\\n<>]+)_((?=\\s)|(?=\\Z)|(?=\\p{Punct}))"; - private final static String citateRegex = "(?:(?<=\\n)|(?<=\\A))\\> *(.*)?(\\n|(?=\\Z))"; + private final static String citateRegex = "(?:(?<=\\n)|(?<=\\A))> *(.*)?(\\n|(?=\\Z))"; public static List getEntities(Message msg) { @@ -144,14 +144,12 @@ public class MessageUtils { } public static String formatMessage(String msg) { - // > citate - msg = msg.replaceAll(citateRegex, "$1"); - msg = msg.replaceAll("", "\n"); - - msg = msg.replaceAll("&", "&"); msg = msg.replaceAll("<", "<"); msg = msg.replaceAll(">", ">"); + // > citate + msg = msg.replaceAll(citateRegex, "$1"); + msg = msg.replaceAll("", "\n"); // -- // — msg = msg.replaceAll("((?<=\\s)|(?<=\\A))\\-\\-?((?=\\s)|(?=\\Z))", "$1—$2"); -- cgit v1.2.3