aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-01-08 05:59:27 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-01-08 05:59:27 +0000
commit0887b534269e17678fda91fee0bf65ad7249170d (patch)
tree03c5c959fe704fb9953983210497b13daa075153 /app/src/main
parent05b8b73043cffed8dabe955c240f4c1ad5f1b51f (diff)
downloadinfinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.tar
infinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.tar.gz
infinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.tar.bz2
infinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.tar.lz
infinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.tar.xz
infinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.tar.zst
infinity-for-reddit-0887b534269e17678fda91fee0bf65ad7249170d.zip
Fix regex for supporting snudown's header.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java3
1 files changed, 2 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 d3140863..b71d3d0f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
@@ -40,7 +40,8 @@ public class Utils {
StringBuilder regexed = new StringBuilder(markdown
.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("#(?![# ])", "# "));
+ .replaceAll("\\^{2,}", "^")
+ .replaceAll("(?<![\\[\\(])#(?![# ])(?![\\w\\s]*[\\]\\)])", "# "));
//Fix superscript
int startIndex = regexed.indexOf("^");