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

Regular expressions are useful, but on a much smaller set of problems than people typically use them for.

For example Chrome's script skipper in the debug tools completely unnecessarily uses regexes rather than a simple list of 'contains'.

It's definitely one of the worst "everything's a nail" hammers a lot of programmers wield. And quite often they've been holding it upside down for years without even realizing it.



Another situation where regexes are possibly abused - syntax highlighting. Yes, there are a lot of languages where you can sanely highlight /most/ code with regexes, but there's a non-zero number where you need a little more context, such as that provided by an AST (which would also help with autocompletion anyway if the highlighting is being done in the context of an editor).


> For example Chrome's script skipper in the debug tools completely unnecessarily uses regexes rather than a simple list of 'contains'.

That is your example of overkill? More like, exactly the sort of scenario where you'd want to be able to specify a regexp.


I'm consistently infuriated every time a search box in a GUI lacks regex support (which is very nearly all of the time).




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

Search: