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 <?php preg_match_all("/<a href=\"(.*?)\" target=\"_blank\">/", $source, $matches); ?> PHP: Which would put all the links neatly in $matches[1] 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. Could anyone help me out here? Thanks.