From fe82b5686e271183771bb801e99f24f88c872fbe Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 27 Aug 2019 09:29:18 +0800 Subject: Fixed regex. --- .../ml/docilealligator/infinityforreddit/LinkResolverActivity.java | 6 +++--- app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/ml/docilealligator') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java index f520ba24..76ef9ffd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java @@ -31,9 +31,9 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String POST_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/{0,1}"; private static final String COMMENT_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/\\w+/{0,1}"; - private static final String SUBREDDIT_PATTERN = "/r/\\w+/*"; - private static final String USER_PATTERN_1 = "/user/\\w+/*"; - private static final String USER_PATTERN_2 = "/u/\\w+/*"; + private static final String SUBREDDIT_PATTERN = "/r/\\w+/{0,1}"; + private static final String USER_PATTERN_1 = "/user/\\w+/{0,1}"; + private static final String USER_PATTERN_2 = "/u/\\w+/{0,1}"; @Inject SharedPreferences mSharedPreferences; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java index dcb5e22d..aa7495cd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java @@ -2,7 +2,7 @@ package ml.docilealligator.infinityforreddit; class Utils { static String addSubredditAndUserLink(String markdown) { - return markdown.replaceAll("(?