NogDog;10927545 wrote:Well, you care about it in that you want it to be matched with the word being searched for ("over") so that it is replaced along with the search word. The "$" is probably redundant, as by default preg_() matches are "greedy", but you still need the "." part, unless I'm completely missing something?
If by preg_() you mean statements like preg_replace or preg_match etc, it isn't the preg statement itself that is inherently greedy, but rather the quantifiers themselves (like and +).
In this case, I agree with your pattern, sans the $. As far as I can tell, . (which is in general frowned upon as it is usually used unwisely) would be the fastest, non-BS solution to match 'everything else' in cases like this (as . and the like do have their 'occasional' uses).