public static boolean matchesAnchor()

in src/main/java/org/apache/maven/doxia/linkcheck/validation/Anchors.java [38:49]


    public static boolean matchesAnchor( String content, String anchor )
    {
        if ( content != null && anchor.length() > 0 )
        {
            // can use name or id attributes and also can use single or double quotes with whitespace around the =
            String regex = "(?i)(name|id)(?-i)\\s*=\\s*('|\")" + escapeBrackets( anchor ) + "('|\")";
            Pattern pattern = Pattern.compile( regex );
            Matcher matcher = pattern.matcher( content );
            return matcher.find();
        }
        return false;
    }