Hacker News new | ask | show | jobs
by Tobba_ 3022 days ago
It'd help a lot if the grammar was actually readable. Combinations like .* don't visually "read" like a single unit, and then to make everything worse you often need a crazy amount of backslashes.

I'm not sure how you could fix that without introducing completely new characters or color-coding parts of the expression though.

1 comments

The back slashes for escaping are absolutely awful. This is one of the worst things about Java.

It's much better in languages with regex literals like Ruby and JavaScript.

It's especially nicer in Ruby (which got it from Perl) where you can use whatever delimiters you like for regexes, with /abc/, %r"abc", %r{abc}, %r#abc# and so on all being equivalent, so you can just about always pick something that won't clash with the characters in your pattern (You can even use spaces as the delimiters, which looks terrible).