Jump to content
Sign in to follow this  
mstdmstdd

Get only headers with end tag

Recommended Posts

The right way is to understand that HTML is an actual language. This means you need an actual parser, not a bunch of half-assed regexes you've come up with.

Edited by Jacques1
  • Like 1

Share this post


Link to post
Share on other sites

Strongly agree. Use the DOM or possibly simplexml for these tasks. Regex is not the right tool for the job.

Share this post


Link to post
Share on other sites

You are right from your point.

But actually that was not not a real task but mastering of regex.

I made some examples in tutorial, trying to play and extend examples...

So has it decision?

Share this post


Link to post
Share on other sites

What's the point of practicing wrong approaches? There are plenty of useful exercises, so why waste time on something that isn't going to help you in the real world?

 

In any case, the regex is badly messed up, and you don't seem to understand the concept behind lookaround patterns. Look that up, then try a simple example and make sure you actually know what's going on.

  • Like 1

Share this post


Link to post
Share on other sites

Could you please give refs to some useful exercises ?

Which could be used in real tasks...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.