[Java] getting links from website source
So I'm writing this program in java which will connect to a website, get it's source and search it for links (<a href="link" target="_blank">)
Now in php I would just do
Which would put all the links neatly in $matches in array form. I have however no idea how to do this in java, I know I have to use java.util.regex.Matcher and java.util.regex.Pattern, but how to go from there has left me stumped.
preg_match_all("/<a href=\"(.*?)\" target=\"_blank\">/", $source, $matches);
Could anyone help me out here?