public List<String> getTwitterLinksFromComment(Comment comment) { List<String> twitterLinks = new ArrayList<>(); Matcher matcher = pattern.matcher(comment.getBody()); while (matcher.find()) { twitterLinks.add(matcher.group(TWITTER_LINK_REGEX_GROUP)); } return twitterLinks; }
public boolean commentMatchesRegex(Comment comment) { return pattern.matcher(comment.getBody()).find(); }