Commit 620cd9d0 authored by Yusuke Iwaki's avatar Yusuke Iwaki

fix regex pattern for parsing format `<http://www.example.com/|text>`

parent 3898b7aa
......@@ -63,14 +63,14 @@ public class MarkDown {
private static void highlightLink2(SpannableString inputText) {
Pattern linkPattern = Pattern.compile(
"(?:<|&lt;)((?:http|https):\\/\\/[^\\|]+)\\|(.+?)(?=>|&gt;)(?:>|&gt;)", Pattern.MULTILINE);
"((?:<|&lt;))((?:http|https):\\/\\/[^\\|]+)\\|(.+?)((?=>|&gt;)(?:>|&gt;))", Pattern.MULTILINE);
Matcher matcher = linkPattern.matcher(inputText);
while (matcher.find()) {
ClickableSpan span = createLinkSpan(matcher.group(2));
setSpan(span, inputText,
matcher.start(), matcher.end(),
matcher.group(1).length() + matcher.group(2).length() + 1,
matcher.group(5).length() + matcher.group(6).length());
matcher.group(4).length());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment