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

Unfortunately regex is the best we have. A bunch of if statements is also a whole less efficient and prone to errors than a regex statement. Once you start to learn regex, it actually isn't that bad. The challenging part is that a lot of people cut and paste not really understanding it and you end up with a bunch of bad regex examples.


Eh, I think the challenging part is understanding a complex regex that's already been written. You really do need good comments and unit tests to go along with a regex in order to understand the intent, otherwise they rapidly become unmaintainable.




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

Search: