Hacker News new | past | comments | ask | show | jobs | submit login

As a lead developer, I frown upon every instance of regex used. If it's shorter then, say, 20 characters, it may be allowed. Longer then that will result in a negative advice and binding advice to refactor. You implement a language lexer & parser, or use plain string functions.



I’d expect you, “as a lead developer,” to know how the tokenizer in your lexer almost certainly works. Rather than frowning upon “every instance of regex used,” I’d expect you to be familiar with cleaner and more maintainable ways of writing regexes, which are, after all, just declarative ways of specifying finite automata. An NFA is infinitely easier to characterize than some mess of a hand written recursive descent parser, precisely because they are so restricted.


You might be interested in the parse python library

https://github.com/r1chardj0n3s/parse


On contrary, I find sed quite valuable.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: