View Single Post
Old 07-28-2014, 05:05 PM   #22
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Tex2002ans View Post
Just because Regex can't do something it wasn't designed to do, doesn't mean Regex must be updated!

You would be using the wrong tool for the job, and what you want is a parser!

Here is some discussion on why Regex isn't recommended for parsing HTML:

https://stackoverflow.com/questions/...e-html-why-not

There is a reason why they are separate beasts.
Yep, basically. Although there are some things you can do with lookaround, like my example. Given a specific known quantity (what regex is for) it will clobber all those nested spans on repeating runs.

Also fun link: http://stackoverflow.com/questions/6...lanation-in-la

The second answer does a good job explaining why regex is a bad tool for html parsing (and when it is a good tool!).
eschwartz is offline   Reply With Quote