4 ms·
It may be a good way to standardize regexp syntax for users of all levels of expertise. Every text editor, shell environment, programming language or desktop a
by TuringTest 4y ago
It may be a good way to standardize regexp syntax for users of all levels of expertise.
Every text editor, shell environment, programming language or desktop application seems to use regular expressions with a syntax which is slightly different to all the others, but not different enough to call it with a different name.
This means that a newbie learning regular expressions will be thrown into an environment where it can learn the basic principles, but the rules it learns are not generalisable to all applications (e.g. do I match an arbitrary string with '*', or '.*' ? Can I reuse matched patterns with (1) or with {1}? Etc.)
A new readable and easy-to-learn syntax that is nevertheless portable may work like markdown, as a simple-yet-universal new way to apply regexp that newcomers may learn with confidence and apply everywhere, replacing all the previous slightly incompatible versions.
- camtarn 4y agoMatching an arbitrary string with '*' is not a regular expression - it's a shell glob pattern. Different thing entirely. Maybe they should be the same thing, yes. And although I don't know for sure, reusing a matched pattern within the regex string using (1) seems like it would be very strange, because () are metacharacters for grouping.
- TuringTest 4y agoThey are valid patterns in MS Word and Notepad++ search and replace, though. (Word uses parentheses to create the group then \1 to reuse it in the replacement string, while Notepad uses $1). That's what I meant about every system using a different syntax for what's basically the same functionality.