> I think we need to digress from regexes a bit by introducing things like 'Separated by'.
You might be interested to learn that perl6 regexes have this, notated '%'. https://docs.perl6.org/language/regexes#Modified_quantifier:...
You might be interested to learn that perl6 regexes have this, notated '%'. https://docs.perl6.org/language/regexes#Modified_quantifier:...
"number" and [0-9] are even worse. That should have been called "digit" and, as another commenter already pointed out, in the age of Unicode, it still is confusing.
As to this attempt at simplifying regex writing and reading: nice try, but I think it needs more work. Apart from the Unicode thing, there's the fact that "letter" only is equivalent [a-z] because of the 'case insensitive' flag.
I think I would go for something that's less grammatical English and more programming language like (alignment of the colons optional)
My default would be to have 'lowercase' mean the Unicode character class. 'ASCII lowercase' would handle [a-z]Adding capture groups, look ahead and look behind, comments, etc. is left as an exercise to the reader (they probably would make this look very ugly)
There's also the issue of nesting, like in this botched attempt to write a regex for URLs:
Of note here is that I think we need to digress from regexes a bit by introducing things like 'Separated by'. Without it, you often need to repeat potentially long phrases (programmatically building your regex can avoid that, but I think you still would need a serialization format, and I also think it makes sense for that to not use a full fledged programming language)Thinking of things of that complexity, I'm starting to think it would be better to have people write a BNF grammar.