4 ms·
For the one that can't stand the cognitive overhead of regex like me, verbal regex is a major improvement: https://github.com/VerbalExpressions/JavaVerbalExpres
by The_rationalist 6y ago
For the one that can't stand the cognitive overhead of regex like me, verbal regex is a major improvement:
https://github.com/VerbalExpressions/JavaVerbalExpressions https://github.com/VerbalExpressions/JavaVerbalExpressions
- morelisp 6y agoI can't imagine finding VerbalExpression regex = regex() .find("a") .capture().find("b").anything().endCapture().then("cd").build(); To involve less "cognitive overhead" than /a(b.*)cd/ For example, what is "anything"? (In this case, "anything" can be nothing.) Where does the capture group start/end? (In normally regexp syntax even naive brace matching will usually tell you.)
- dragonwriter 6y agoI don’t see how that’s less cognitive overhead. It uses words, but not only are some of the choices individually dubious for what they do (using domain specific symbols isn’t higher cognitive load than using common words with no obvious domain specific meanings), it breaks a cardinal rule of naming in an API by using different parts of speech to name things of the same kind, mixing verbs (“find”) and nouns (“anything”). It’s way more verbose, but not, in any way I can tell, lower cognitive load.
- morelisp 6y agoEven as structured regular expression languages go it's quite a poor example since it doesn't capture any of the, uh, structure, of the regular expression. In the end it still has all the downsides of the linear string syntax (and none of the upsides - it's not composable at all either, for example), isn't really clearer, and it'll be immensely slower.