Fix regex matcher for # heading.

This commit is contained in:
Alex Ning 2021-01-18 10:45:08 +08:00
parent c2abe90ba2
commit 453b56d485

View File

@ -41,7 +41,12 @@ 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("((?<=[\\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("\\^{2,}", "^")
.replaceAll("(?<![\\[\\(])#(?![# ])(?![\\w\\s]*[\\]\\)])", "# ")); .replaceAll("^#(?!($|\\s))", "# ")
.replaceAll("^##(?!($|\\s))", "## ")
.replaceAll("^###(?!($|\\s))", "### ")
.replaceAll("^####(?!($|\\s))", "#### ")
.replaceAll("^#####(?!($|\\s))", "##### ")
.replaceAll("^######(?!($|\\s))", "###### "));
//Fix superscript //Fix superscript
int startIndex = regexed.indexOf("^"); int startIndex = regexed.indexOf("^");