113
submitted 1 day ago* (last edited 1 day ago) by cypherpunks@lemmy.ml to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] Zarobi@aussie.zone 5 points 1 day ago

Nothing is wrong with that, but it will give you different output. I tend to like using capture groups just out of habit, it makes it more flexible and useful in future. Most of my co-workers hated Regex so I tried to make it easy for them.

I also wanted the letters to be as close together as possible. In this example it doesn't matter, but in other texts it might. Yours will find the first y, then the furthest possible e, then the furthest possible s. So you might get output where there's a y on line 1 and the e s at the very end of the text. Nothing wrong with that, it's just not what I was envisioning.

Also it's funnier in this context to have a complicated regex.

this post was submitted on 15 Jul 2026
113 points (99.1% liked)

Programmer Humor

42848 readers
75 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 7 years ago
MODERATORS