3 ms·
I'm not suggesting that you code doesn't work, if that is what your thinking! It's just a terminology thing. What you describe ("sometimes I extract bits of a
by olavk 11y ago
I'm not suggesting that you code doesn't work, if that is what your thinking! It's just a terminology thing.
What you describe ("sometimes I extract bits of a page with one regex and process it more with further regexes in another function") sounds like a recursive descent parser, which is a very common way to implement a simple and fast parser.
I'm not suggesting you can't parse html with the help of regexes, I'm just stating that you cannot parse html only with a regex: You cannot apply a single regex to the html and get something similar to a DOM out. You need some kind of stack or recursive programming logic in order to extract a recursive or hierarchical data structure from a string.