Regular Expressions Explained: How Regex Really Works
<.+> against <b>bold</b> and <i>italic</i> doesnât match <b>. It matches the whole string, from the first < to the very last >. Nothing is broken. That is what a greedy quantifier is supposed to do, and it is also the most common âregex is matching too muchâ bug there is. Once you know what the engine does while it reads your pattern, this bug and most of its relatives stop being mysteries. ...