News for hackers. Stuff that matters.
Re:Learn RegEx step by step, from zero to advanced by tyingq on Wednesday November 17, 2021 @09:27AM (#29253396)
You can get a feel for what that would look like here: 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.

Re:Learn RegEx step by step, from zero to advanced by wruza on Wednesday November 17, 2021 @11:19AM (#29255017)

        -> 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.
Re:Learn RegEx step by step, from zero to advanced by PennRobotics on Wednesday November 17, 2021 @12:08PM (#29255705)
Like 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.
Re:Learn RegEx step by step, from zero to advanced by wruza on Wednesday November 17, 2021 @12:20PM (#29255872)
So 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.
Re:Learn RegEx step by step, from zero to advanced by jazzyjackson on Wednesday November 17, 2021 @03:59PM (#29258753)
not every solution has to be reusable
Re:Learn RegEx step by step, from zero to advanced by balabaster on Wednesday November 17, 2021 @11:59AM (#29255578)
Your 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;

Re:Learn RegEx step by step, from zero to advanced by wruza on Wednesday November 17, 2021 @12:09PM (#29255718)
I 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.

Re:Learn RegEx step by step, from zero to advanced by cinntaile on Wednesday November 17, 2021 @10:25AM (#29254292)
Readability 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.
Re:Learn RegEx step by step, from zero to advanced by tyingq on Wednesday November 17, 2021 @10:40AM (#29254516)
It's more readable individually, but for many regexes the verbose nature could make it harder to read overall.
Re:Learn RegEx step by step, from zero to advanced by Zababa on Wednesday November 17, 2021 @10:49AM (#29254614)
There'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