Issue
What is the best way to select all the text between 2 tags - ex: the text between all the '<pre>
' tags on the page.
Solution
You can use "<pre>(.*?)</pre>"
, (replacing pre with whatever text you want) and extract the first group (for more specific instructions specify a language) but this assumes the simplistic notion that you have very simple and valid HTML.
As other commenters have suggested, if you're doing something complex, use a HTML parser.
Answered By - PyKing
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.