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

I've been on several projects maintaining code by people who were ignorant to regex or otherwise refused to use them. Their code is littered with indexOf operations and charAt and all sorts of things like that. And they build those calls up one after the other creating all sorts of intermediate variables. It's a gigantic mess and I can usually remove 50-80% of that code (my guess) with regex. I think regex is far more maintainable and easier to read.

As far as no comments or not being able to debug, you can place each regex in a clearly named variable. And for debugging, there are a wealth of external tools out there, and in Java you certainly can step through them in a debugger (if you like pain). Like code, there are ways to write regex that are more readable and maintainable than others. We should make our regexes clear and used in conjunction with well thought out code. Then the software is a joy to work with, after spending 2 days studying regular-expressions.info.




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

Search: