25 lines
529 B
Plaintext
25 lines
529 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
r"(?:)*" # same as the empty regex, the '*' accomplishes nothing
|
|
r"(?:|x)*" # same as the empty regex, the alternative has no effect
|
|
r"(?:x|)*" # same as 'x*', the empty alternative has no effect
|
|
r"(?:x*|y*)*" # same as 'x*', the first alternative would always match, y* is never tried
|
|
r"(?:x?)*" # same as 'x*'
|
|
r"(?:x?)+" # same as 'x*'
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
r"x*"
|
|
----
|
|
|