class ContentDateGetter extends TechniqueDateGetter<ContentDate> {

    static List<ContentDate> findAllDates(String text) {
        List<ContentDate> dates = new ArrayList<>();
        for (DateFormat format : RegExp.ALL_DATE_FORMATS) {
            Matcher matcher = format.getPattern().matcher(text);
            while (matcher.find()) {
                boolean digitNeighbor = false;
                int start = matcher.start();
                if (start > 0) {
                    digitNeighbor = Character.isDigit(text.charAt(start - 1));
                }
                int end = matcher.end();
                if (end < text.length()) {
                    digitNeighbor = Character.isDigit(text.charAt(end));
                }
                if (!digitNeighbor) {
                    String dateString = matcher.group();
                    ContentDate date = new ContentDate(DateParser.parseDate(dateString, format));
                    int datePosition = text.indexOf(date.getDateString());
                    date.setTagPos(datePosition);
                    text = text.replaceFirst(dateString, StringUtils.repeat('x', dateString.length()));
                    dates.add(date);
                }
            }
        }
        return dates;
    }

}