== Why is this an issue? include::../description.adoc[] === Noncompliant code example [source,php] ---- preg_replace("/start\w*?(end)?/", "x", "start123endstart456"); // Noncompliant. In contrast to what one would expect, the result is not "xx". preg_match("/^\d*?$/", "123456789"); // Noncompliant. Matches the same as "/^\d*$/", but will backtrack in every position. ---- === Compliant solution [source,php] ---- preg_replace("/start\w*?(end|$)/", "x", "start123endstart456"); // Result is "xx". preg_match("/^\d*$/", "123456789"); ----