== Why is this an issue?

include::../description.adoc[]


=== Noncompliant code example

[source,python]
----
re.replace(r"start\w*?(end)?", "x", "start123endstart456") # Noncompliant. In contrast to what one would expect, the result is not "xx"

re.match(r"^\d*?$", "123456789") # Noncompliant. Matches the same as "/^\d*$/", but will backtrack in every position.
----


=== Compliant solution

[source,python]
----
re.replace(r"start\w*?(end|$)", "x", "start123endstart456") # Result is "xx"

re.match(r"^\d*$", "123456789")
----

