java - Regular expression to match text between <a ..> and </a> -


could able give regular expressiont match link text between <a> , </a> tags in html snippet.

sample data: <a href="link.html">link title</a> - 15 comments <br/> <a href="otherlink.html">some other title</a> - 6 comments

requirement: need extract link texts (i.e. 1 between <a> , </a> - link title , some other title) use in application.

please note link text might contain non-english characters , possible puncutations also. tried using '.' operator, since greedy match, matches entire text between first <a> , last </a>. want link texts.

any help?

try

<a[^>]+>(.*?)</a> 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -