Earlier today I had a problem with my BBCode function messing up the text formatting when bold tags or url tags were used more than once. I was told to use ? after the quantifier in the expression in order to make preg_replace() "not greedy". That fixed it.
I'm afraid I don't really understand what "being greedy" means. The PHP website says that if an expression is greedy, it will match as much as possible. It it's not, it will match as little as possible. To me, that sounds like being greedy should have worked just fine if a bold or url tag was used more than once, since being greedy matches as much as possible.
Could someone correct my thinking, please?