|
|
|
|
|
by rspeer
3957 days ago
|
|
It's true anyway. The limited depth means it has a finite number of states, regardless of the length, and that's all you need for it to be regular. But this is a technicality and it should in no way indicate that a regex for HTML would be a good idea. |
|
Say you had a recursive data structure with a very small maximum nesting depth, like 5. Should you use a regex then? I would argue still no: there's no computational problem, but writing a correct regex to do so is still bug-prone. At least, writing one manually is. In the case of small finite nesting depths there might occasionally be reasons to mechanically compile something that looks more like EBNF to a DFA or NFA. But something else might well be better. At that point it's just an efficiency question.