commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Sometimes, especially when parsing HTML, you want "all text between two tags, that doesn't contain another tag".
For example, to grab only the contents of the innermost <div>s, something like:
...may be your best option to capture that text.
It's not always needed, but is a powerful arrow in your regex quiver in those cases when you do need it.
Note that, in general, regular expressions are the Wrong Choice for parsing HTML, anyway. Better approaches are solutions which let you navigate the HTML as a proper DOM. But sometimes, you just need to use the tools available to you. If you don't, then you have two problems.
There are 4 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.