@Nullable
    @SuppressFBWarnings("DM_STRING_CTOR")
    public static String getMatch(@Nullable final String data, final Pattern pattern, final boolean trim, final int group, @Nullable final String defaultValue, final boolean last) {
        if (data != null) {
            final Matcher matcher = pattern.matcher(data);
            if (matcher.find()) {
                String result = matcher.group(group);
                while (last && matcher.find()) {
                    result = matcher.group(group);
                }

                if (result != null) {
                    final Matcher remover = PATTERN_REMOVE_NONPRINTABLE.matcher(result);
                    final String untrimmed = remover.replaceAll(" ");

                    // Some versions of Java copy the whole page String, when matching with regular expressions
                    // later this would block the garbage collector, as we only need tiny parts of the page
                    // see http://developer.android.com/reference/java/lang/String.html#backing_array
                    // Thus the creation of a new String via String constructor is voluntary here!!
                    // And BTW: You cannot even see that effect in the debugger, but must use a separate memory profiler!
                    //noinspection StringOperationCanBeSimplified
                    return trim ? new String(untrimmed).trim() : new String(untrimmed);
                }
            }
        }

        return defaultValue;
    }
Searches for the pattern pattern in the data. If the pattern is not found defaultValue is returned

@param data         Data to search in
@param pattern      Pattern to search for
@param trim         Set to true if the group found should be trim'ed
@param group        Number of the group to return if found
@param defaultValue Value to return if the pattern is not found
@param last         Find the last occurring value
@return defaultValue or the n-th group if the pattern matches (trimmed if wanted)
main/src/main/java/cgeo/geocaching/utils/TextUtils.java