Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regex: Extracting text between two HTML tags

JörgFeb 4 2010 — edited Feb 5 2010
Hello,

the common answer to this question would be
<tag>(.*)</tag>
or
<tag>[^<]*
But I have LFs (and whitespace) around the tags:
<html>
  <body>
    One text line to be retrieved.
  </body>
</html>
So I tried
(?s)<body>(.*)</body>
But that didn't help.
What's missing?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2010
Added on Feb 4 2010
12 comments
5,514 views