diff options
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java | 6 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java | 4 |
2 files changed, 5 insertions, 5 deletions
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("(?<!\\w)/*u/\\w+/*", "[$0]($0)") - .replaceAll("(?<!\\w)/*r/\\w+/*", "[$0]($0)"); + return markdown.replaceAll("(?<!\\w)/{0,1}u/\\w+/{0,1}", "[$0]($0)") + .replaceAll("(?<!\\w)/{0,1}r/\\w+/{0,1}", "[$0]($0)"); } } |