3 ms·
I guess NFA is the classic regex, but most implementations are vastly more powerful through the introduction of backtracking and back references. In any case,
by revelation 11y ago
I guess NFA is the classic regex, but most implementations are vastly more powerful through the introduction of backtracking and back references.
In any case, a regex is hilariously unsuitable for the purpose here. It's obtuse, it has terrible corner case performance (as noticed here), it probably took vastly longer to write than a simple loop and apparently it isn't even correct.