Creating java regex to get href link
Sorry if this has been asked before, but I couldn't find any answers on the web. I'm having a hard time figuring out the inverse to this regex: "\"[^>]*\">" I want to use replaceAll to replace everything except the link. So if I had a tag similar to this: <p><a href="http://www.google.com">Google</a></p> I need a regex that would satisfy this: s.replaceAll(regex, ""); to give me this output: http://www.google.com I know there are better ways to do this, but I have to use a regex. Any help is really appreciated, thanks! You do not have to use replaceAll . Better use pattern groups like the