Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Creating your own ad-hoc pattern matcher instead of using the ubiquitous one built into your language

GP was using LINQ, which is a first-class language construct in C#. I'll grant that it may not be _as_ optimized as Perl's regex routines, but it's hardly ad-hoc or slow.



Yes, the linked example falls in the category of "particularly simple patterns" I mentioned. This strategy only works for such simple patterns; add in a single alternation with a common base and the naïve iteration strategy falls apart. Implementing a sensible algorithm to evaluate such a pattern would require much more code than a couple of brackets, would not benefit from RegEx caching, etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: