/** * Validates the given project key and returns true if valid, false otherwise. * * @param key project key to validate * @return True if the supplied project key is valid */ public static boolean validProjectKey(final String key) { return getKeyMatcher().isValidProjectKey(key); }
/** * Determines whether any JIRA issue key is in the given string * * @param s string to check * @return true if a key was found, false otherwise */ public static boolean isKeyInString(final String s) { return getKeyMatcher().isKeyInString(s); }
/** * Validates the given issue key. * * @param key issue key * @return True if the supplied issue key starts with a valid project key, and ends with a number */ public static boolean validIssueKey(final String key) { return getKeyMatcher().isValidIssueKey(key); }
public static String getIssueKeyRegex() { return getKeyMatcher().getIssueKeyRegex(); }
if (getKeyMatcher().isKeyDetectionBackwardsCompatible())
public static List<String> getIssueKeysFromString(String body) { if (isBlank(body)) { return Collections.emptyList(); } final Perl5Util util = new Perl5Util(); //note that we have to create a new match, as MatchResult is not Threadsafe final List<String> result = new ArrayList<String>(); while (util.match(getKeyMatcher().getIssueKeyRegex(), body)) { final MatchResult match = util.getMatch(); // The issue key is composed of the all sub-pattern match // groups after the initial sub pattern match group final int matchGroups = match.groups(); // Check backs from the key to see if it part of the url & URL is ignored if (!getKeyMatcher().isIgnoreUrlWithKey() || !isPartOfUrl(body, match.beginOffset(2))) { result.add(createKeyFromMatchingGroups(matchGroups, match)); } body = body.substring(match.endOffset(matchGroups - 1)); } return Collections.unmodifiableList(result); }
private static boolean isKeyInStringMatchingRegex(final String issueKey, String body) { final Perl5Util util = new Perl5Util(); //note that we have to create a new match, as MatchResult is not Threadsafe while (util.match(getKeyMatcher().getIssueKeyRegex(), body)) { final MatchResult match = util.getMatch(); // The issue key is composed of the all sub-pattern match // groups after the initial sub pattern match group final int matchGroups = match.groups(); final String key = createKeyFromMatchingGroups(matchGroups, match); if (issueKey.equals(key)) { // Check backs from the key to see if it part of the url & URL is ignored if (!getKeyMatcher().isIgnoreUrlWithKey() || !isPartOfUrl(body, match.beginOffset(2))) { return true; } } body = body.substring(match.endOffset(matchGroups - 1)); } return false; }
while (util.match(getKeyMatcher().getIssueKeyRegex(), body)) buff.append(getKeyMatcher().getLink(key));