3 ms·
No. I wrote about this awhile back (https://reindeereffect.github.io/2018/06/24/regex/#the-limits-of-regular-expressions https://reindeereffect.github.io/2018/0
by kmstout 7y ago
No. I wrote about this awhile back (https://reindeereffect.github.io/2018/06/24/regex/#the-limits-of-regular-expressions https://reindeereffect.github.io/2018/06/24/regex/#the-limit...). From that post:
[M]atching parentheses requires our recognition device to remember how many unmatched open parentheses there are. Since the only way for a DFA to remember anything is to be in one of a set of states corresponding to it, and since the unmatched open parentheses could easily outnumber the available states, we can see that the fundamental limitation of a DFA is that it can store only a finite amount of information (remember the ‘F’ in DFA?). This limitation applies to any string matching task that involves recursive structures or algebraic relationships between substrings. It is why “HTML and regex go together like love, marriage, and ritual infanticide.”