regex to pull web links in java

anyone know the regex patters to go through a string and pull all web links from <a href
and display in the form www.google.com
enigma1234567890Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

enigma1234567890Author Commented:
i want to do it via regex
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

a_bCommented:
use Pattern.compile("href=\\\"(.*?)\\\"", Pattern.CASE_INSENSITIVE)
0
enigma1234567890Author Commented:
this returns stuff like href="http://google.com"  ho do i drop the href

thanks
0
a_bCommented:
Just get the substring of the retrurned string from position 5 to sting lenght
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
enigma1234567890Author Commented:
finally

is their a method to not report blank  href=""
0
Terry WoodsIT GuruCommented:
Modifying enigma's suggestion, try:

Pattern.compile("(?:href=\\\")([^\\\"]+?)(?:\\\")", Pattern.CASE_INSENSITIVE)
0
enigma1234567890Author Commented:
could you explain what is taking place for example what does the following do

?
\\\
^\\\


thanks
0
Terry WoodsIT GuruCommented:
(?:blah) is a non-capturing sub pattern. It means match blah but don't capture it in the result.

[^abc] means match any one character that's not a or b or c

\\\" is used to match a double quote character. I'm probably not the best person to explain how escaping backslash characters works in java, but it somehow works out that they need double-escaping! People (including me) commonly get confused with how many backslashes to use.
0
Terry WoodsIT GuruCommented:
You might find this cheat-sheet useful:
http://www.phpguru.org/article/pcre-cheat-sheet
0
enigma1234567890Author Commented:
thanks all will close the call
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.