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

His examples were bad (asterisk etc.) but the point is valid. There is some hairy regular expression syntax that is pretty difficult to grok right off the bat. It could be simpler and clearer.


You could say that about any syntax. But actually coming up with a better syntax is much harder than just saying it can be done.


There's VerbalExpressions, which simply wrap common PCRE tokens into methods/functions: https://github.com/VerbalExpressions


This is awesome, like life-changing awesome! I always felt an impedance mismatch between how my mind describes string patterns and how regexps are written. VerbalExpressions is the closest thing I've seen to how I naturally think.


This is going to rapidly replace every instance of regex in my code. The readability improvement is immeasurable. It's also conveniently similar enough to Python's verbose regex syntax.


Those are pretty good, if a little verbose.


You could say that about any syntax. But in most cases it would still apply much more to things like Perl regular expressions.


No one forces you to memorize every possible mnemonic, you remember the basic stuff that you use all the time, than you learn a bit more when you need it. And there is google for the rest, just like with everything else. And I seriously doubt that it could be made simpler and clearer for everyone, because we all come from different backgrounds and work on different things and our brains are by now hardwired to quickly handle different syntaxes. So it is a huge undertaking to rewrite something as complex as regexp to a completely new syntax and yet clearer and simpler to the majority of devs. Which of course doesn't mean one shouldn't try...




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

Search: