I have a String var, which contains HTML content, what i want to do is match any abc
and extract xyz and abc from the tag. Now i want to save this for all the <a href> in the HTML page.
I tried doing it with the following but it doesn't work.

PHP Code:
            pattern Pattern.compile("href=(?:\"|\')?.*(?:\"|\')?(>)?.*(</a>)?");
            
matcher pattern.matcher(pageContents);

            if(
matcher.find())
                    
pageContents2 matcher.replaceAll("$1 $2"); 
Please advice and guide.