Regex is so FRUSTRATING

Regex is so FRUSTRATING
0

I feel like I was flying through the content on here:

  • Html and CSS? - rocked it out.
  • Javascript Basics? - flew through that.
  • ES6? - Felt a bit like a blur.

Admittedly, I stumbled a bit with grasping recursion as a concept but eventually it clicked! Just don’t ask me in a month when I should use it over a loop, but I at least get it. But this Regex section…

It makes me feel so stupid. This is the first section where I HAD to look at the hints, and even then I tried googling the topic, and even then I had to look through the solution. Maybe it’s just too abstract of a concept or maybe I’m lacking a key strength for programming. It just feels like I’m constantly just brute forcing for a solution in my console with only a minimum of knowing where the solution generally is.

I dunno, Regex isn’t giving me an “Ah Ha! Now I get it!” moment and I just wanted to vent and maybe see if other people struggled with it as well?

Hi,
I felt the same at first. There are a few things that really helped me grasp it though. Firstly there are great only regex testers, that visualize how each part works and what passes the regex.
There is also a really good (and short) Liveoverflow video on the topic that might help.

2 Likes

Thanks for the additional resources! I think just I’ve gotten so used to natural(ish) programming languages, that regex just looks so foreign to me.

It is probably something I will just have to keep practicing, but thanks for the little nudge!

There are probably a few grey-bearded Pearl masters still out there that can look at 30 or 40 character regexp and read it like it was a tweet. For the rest of us it’s often more like write only code.
Thank goodness computers can read it better than I can :laughing:

Perl graybeard here, wagging his finger at you for calling it “Pearl” :grimacing: I grok regexes pretty well, but I worked with regexes day in and day out for 13 years (anti-spam), and before that I was writing triggers for MUD clients, and was a Unix sysadmin, where grep is something you use every day. Even then it’s still a gradual trial-and-error process that I work out with something like regex101.com. Regex syntax is terribly terse, and something you just get used to with practice.

Perl regexes also support comments via the /x flag. Don’t think JS has that.

3 Likes

Oops ! sorry Pe^arl. I wouldn’t stand a chance ! Still feel a sense of accomplishment when when ever i get a regex to do what I expect. Even If it makes no sense a ten minutes later :laughing:

1 Like

Really glad(?) to hear that in some ways it only gets better if you use it on the daily and even then referring to resources is still not unexpected.

As someone who used to have just an exceedingly wonderful memory and did well as a student, something like programming where you it seems like success is more rooted in understanding what patterns to look for to code well rather then knowing every last detail make it difficult to unlearn some bad “learning” habits I built up over 35 years.

Lol, I had never faced that issue :smile: