3 ms·
That's very interesting, because I've always felt that it should be possible to parse the regex and match the target at the same time... (though nobody ever doe
by 13ren 18y ago
That's very interesting, because I've always felt that it should be possible to parse the regex and match the target at the same time... (though nobody ever does it that way, instead doing it with 2 passes).
Do you know of a proof that grouping and alternation cannot be implemented in this way? (formal or informal).
- gregwebs 18y agoIt is possible with the addition of back tracking capabilities (the most crude of which would be to just be able to look backwards in the regex). But at that point the implementation will be complex and the implementers should wonder why they did not implement a compile phase for the regex string. A compile phase also gives a chance for optimizations of the regex.