• Zarobi@aussie.zone
    link
    fedilink
    English
    arrow-up
    3
    ·
    8 hours 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.