aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorscria1000 <91804886+scria1000@users.noreply.github.com>2021-11-14 13:34:50 +0000
committerscria1000 <91804886+scria1000@users.noreply.github.com>2021-11-14 13:34:50 +0000
commitef1bdf2fa5fa4505e609b0862d9c7ed01659da38 (patch)
tree49a865a61b3a59e1c4ba9e2cb90f1ab4481c7cd7 /app/src
parent839325efbedb108917b37353c9493fea305d71e2 (diff)
downloadinfinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.tar
infinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.tar.gz
infinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.tar.bz2
infinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.tar.lz
infinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.tar.xz
infinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.tar.zst
infinity-for-reddit-ef1bdf2fa5fa4505e609b0862d9c7ed01659da38.zip
Optimize spoiler regex
Optimize spoiler regex to allow at least one new line. >! match this!< >!match this!< >! match this!< >!don't match this<! >! match this !< >!match this !<
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
index 0b49ba31..525dfa2a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
@@ -65,7 +65,7 @@ public class Utils {
.replaceAll("((?<=[\\s])|^)/[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com$0)")
.replaceAll("((?<=[\\s])|^)[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com/$0)")
.replaceAll("\\^{2,}", "^")
- .replaceAll(">!", "&gt;!") // If it's in a code block, html entity remains escaped
+ .replaceAll("(?:>!)(\\n?[\\S\\h]+?\\n?[\\S\\h]+\\n?!<)", "&gt;!$1") // html entity remains escaped inside an inline block
.replaceAll("(^|^ *|\\n *)#(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)##(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)###(?!($|\\s|#))", "$0 ")