3 ms·
You can get a feel for what that would look like here: https://metacpan.org/release/CHROMATIC/Regexp-English-1.01/view/lib/Regexp/English.pm https://metacpan.or
by tyingq 5y ago
You can get a feel for what that would look like here: https://metacpan.org/release/CHROMATIC/Regexp-English-1.01/view/lib/Regexp/English.pm https://metacpan.org/release/CHROMATIC/Regexp-English-1.01/v...
But then you're just memorizing things like 'start_of_line' instead of '^'. Perhaps easier to read, but no easier to write.
- cinntaile 5y agoReadability is very important though. If you can spend a couple of more seconds of programmming time to prevent several minutes(or longer!) of understanding time, I'd call that a good use of resources. I don't think that link is quite there yet but it's a good start.
- Zababa 5y agoThere's a good article about K that can give you a feel on how long names may not always be more readable: http://nsl.com/papers/denial.html http://nsl.com/papers/denial.html
- tyingq 5y agoIt's more readable individually, but for many regexes the verbose nature could make it harder to read overall.
- wruza 5y ago-> start_of_line -> literal('Flippers') -> literal(':') -> optional -> whitespace_char -> end -> remember -> multiple -> digit; I literally can’t parse this as a whole. /^Flippers:\s?(\d+)/ is so much more obvious compared to that utter nonsense.
- balabaster 5y agoYour long-hand isn't quite the same as your regex...it should be remember -> one_or_more -> digit; In regex parlance, \d+ explicitly allows for one or more digits. Multiple tacitly implies 2 or more which would be \d{2,} Also, your end char (which I assume you mean $) would be after the remember -> one_or_more -> digit;
- wruza 5y agoI didn’t refer to the manual (which is the entire goal of that format, isn’t it?) and don’t know what ‘multiple’ really means. So I stand both corrected and confirmed, I guess. That ‘end’ thing just closes the ‘optional’ group, I believe. There is no $ in an English form of this regex either.
- PennRobotics 5y agoLike most code, it's easier to write regex than to read it later. In my recent vim history: /(\([^()]\|\n\)*\n\([^()]\|\n\)*) This was from two days ago. I think I was searching a huge sheet of regex match groups for any having line breaks to join. In a month, I'm not even sure I would recognize that I had authored this.
- wruza 5y agoSo what. That was a problem you had to solve, imagine how helpless you’d feel if you had it with no regex available. Matching non-parenthesis or newline for two lines (prefix and suffix unrestricted) it is. Idk if it took half an hour or more to implement that in python, js or (god forbid) a low level language. You probably made it in less than a minute. And nobody would take their time to read a page of .substr(i, -(j-i)-1) two days later either.
- jazzyjackson 5y agonot every solution has to be reusable