Source:
<code>public Link matchAnchor(Post.Builder post, CharSequence text, Element anchor, PostParser.Callback callback) { String href = anchor.attr("href"); if(href.matches(" href = href.substring(2); <START> href = href.substring(href.indexOf('/')); <END> } PostLinkable.Type t; Object value; Matcher externalMatcher = fullQuotePattern.matcher(href); if (externalMatcher.matches()) { String board = externalMatcher.group(1); int threadId = Integer.parseInt(externalMatcher.group(2)); int postId = Integer.parseInt(externalMatcher.group(3)); if (board.equals(post.board.code) && callback.isInternal(postId)) { t = PostLinkable.Type.QUOTE; value = postId; } else { t = PostLinkable.Type.THREAD; value = new PostLinkable.ThreadLink(board, threadId, postId); } } else { Matcher quoteMatcher = quotePattern.matcher(href); if (quoteMatcher.matches()) { t = PostLinkable.Type.QUOTE; value = Integer.parseInt(quoteMatcher.group(1)); } else { Matcher boardLinkMatcher = boardLinkPattern.matcher(href); Matcher boardSearchMatcher = boardSearchPattern.matcher(href); if(boardLinkMatcher.matches()) { t = PostLinkable.Type.BOARD; value = boardLinkMatcher.group(1); } else if (boardSearchMatcher.matches()) { String board = boardSearchMatcher.group(1); String search = boardSearchMatcher.group(2); t = PostLinkable.Type.SEARCH; value = new PostLinkable.SearchLink(board, search); } else { t = PostLinkable.Type.LINK; value = href; } } } Link link = new Link(); link.type = t; link.key = text; link.value = value; return link; }</code><technical_language>instead of string manipulation, [Uri class](<LINK_0></technical_language>

Target:
public Link matchAnchor(Post.Builder post, CharSequence text, Element anchor, PostParser.Callback callback) { String href = anchor.attr("href"); if (href.matches(" href = href.substring(2); href = href.substring(href.indexOf('/')); } PostLinkable.Type t; Object value; Matcher externalMatcher = fullQuotePattern.matcher(href); if (externalMatcher.matches()) { String board = externalMatcher.group(1); int threadId = Integer.parseInt(externalMatcher.group(2)); int postId = Integer.parseInt(externalMatcher.group(3)); if (board.equals(post.board.code) && callback.isInternal(postId)) { t = PostLinkable.Type.QUOTE; value = postId; } else { t = PostLinkable.Type.THREAD; value = new PostLinkable.ThreadLink(board, threadId, postId); } } else { Matcher quoteMatcher = quotePattern.matcher(href); if (quoteMatcher.matches()) { t = PostLinkable.Type.QUOTE; value = Integer.parseInt(quoteMatcher.group(1)); } else { Matcher boardLinkMatcher = boardLinkPattern.matcher(href); Matcher boardLinkMatcher8Chan = boardLinkPattern8Chan.matcher(href); Matcher boardSearchMatcher = boardSearchPattern.matcher(href); if (boardLinkMatcher.matches() || boardLinkMatcher8Chan.matches()) { t = PostLinkable.Type.BOARD; value = boardLinkMatcher.matches() ? boardLinkMatcher.group(1) : boardLinkMatcher8Chan.group(1); } else if (boardSearchMatcher.matches()) { String board = boardSearchMatcher.group(1); String search = boardSearchMatcher.group(2); t = PostLinkable.Type.SEARCH; value = new PostLinkable.SearchLink(board, search); } else { t = PostLinkable.Type.LINK; value = href; } } } Link link = new Link(); link.type = t; link.key = text; link.value = value; return link; }