7

Oct 08

Regex on HTML code

<TAG\b[^>]*>(.*?)</TAG> matches the opening and closing pair of a specific HTML tag. Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do.

No comments yet, be the first.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.