Fix an issue in modifyMarkdown(String markdown) in Utils.Utils about matching subreddits and users.

This commit is contained in:
Alex Ning 2020-08-26 15:24:49 +08:00
parent 331704e5ef
commit 285bb0c385

View File

@ -34,7 +34,7 @@ public class Utils {
private static final long YEAR_MILLIS = 12 * MONTH_MILLIS;
public static String modifyMarkdown(String markdown) {
StringBuilder regexed = new StringBuilder(markdown.replaceAll("((?<=[\\s])|^)/{0,1}[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com/$0)"));
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)"));
int startIndex = 0;