public static void replaceUrlClickAction(final Spannable spannable, final Func4<URLSpan, Spannable, Integer, Integer, Boolean> filter, final Consumer<URLSpan> newAction) {

        final URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class);
        for (final URLSpan span : spans) {
            final int start = spannable.getSpanStart(span);
            final int end = spannable.getSpanEnd(span);
            final Boolean result = filter == null ? Boolean.TRUE : filter.call(span, spannable, start, end);
            if (result == null || Boolean.TRUE.equals(result)) {
                final int flags = spannable.getSpanFlags(span);
                spannable.removeSpan(span);
                spannable.setSpan(new ClickableSpan() {
                    @Override
                    public void onClick(final @NonNull View widget) {
                        newAction.accept(span);
                    }
                }, start, end, flags);
            }
        }
    }
replaces found URLSpans with given condition with a new action
main/src/main/java/cgeo/geocaching/utils/html/HtmlUtils.java