21 ms·
Just to chime on among the naysayers, I just read your regex at "the speed of flow". Made perfect sense to me. (I'd have used non-matching groups, but that's a
by ttfkam 4y ago
Just to chime on among the naysayers, I just read your regex at "the speed of flow". Made perfect sense to me. (I'd have used non-matching groups, but that's a very minor nit.)
The equivalent code to parse this is much longer and arguably to me not really easier to grok. (Unless of course you regularly avoid regex, in which case it will always remain hard.)
I'd say the hardest thing for beginners is the character class and how it matches EXACTLY ONE LETTER without a modifier. Everything matches exactly one letter without a modifier. It seems intuitive to me, but obviously a lot of folks have trouble with it, so I accept that we are outliers.
Reminds me a bit of folks who steadfastly avoid SQL. You have to change the flow in your brain; there's more than one flavor of flow. For regex, it's the watching for single character match with optional modifier. For SQL, it's thinking in terms of sets, not instructions.
If regexes make you feel stupid, lean into it instead of recoiling from it. That's where the learning happens: immersion into the uncertainty until it becomes familiar.
- _dain_ 4y ago>Reminds me a bit of folks who steadfastly avoid SQL. You have to change the flow in your brain; there's more than one flavor of flow. For regex, it's the watching for single character match with optional modifier. For SQL, it's thinking in terms of sets, not instructions. I'm one of those people, SQL just doesn't fit in my brain right :(
- ttfkam 4y agoNothing logical ever does. The human brain is a pattern recognition engine. You just haven't had enough time with these particular patterns. It's like spoken language; it just takes time, exposure, and practice. Just find the right strategy for you to internalize the patterns. Maybe a game? https://mystery.knightlab.com/walkthrough.html https://mystery.knightlab.com/walkthrough.html