diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-27 01:29:18 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-27 01:29:18 +0000 |
commit | fe82b5686e271183771bb801e99f24f88c872fbe (patch) | |
tree | c3351cb100cebda45e83d50aaa19bdbd9b0dba6a /app/src | |
parent | 3d50afd1396fcf80d11ba1fb43ce1194a7f65bf0 (diff) | |
download | infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.tar infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.tar.gz infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.tar.bz2 infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.tar.lz infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.tar.xz infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.tar.zst infinity-for-reddit-fe82b5686e271183771bb801e99f24f88c872fbe.zip |
Fixed regex.
Diffstat (limited to 'app/src')
-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)"); } } |