2021-08-31 16:57:18 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,javascript]
|
2021-08-31 16:57:18 +02:00
|
|
|
----
|
|
|
|
/(?:)*/ // same as the empty regex, the '*' accomplishes nothing
|
|
|
|
/(?:|x)*/ // same as the empty regex, the alternative has no effect
|
|
|
|
/(?:x|)*/ // same as 'x*', the empty alternative has no effect
|
|
|
|
/(?:x*|y*)*/ // same as 'x*', the first alternative would always match, y* is never tried
|
|
|
|
/(?:x?)*/ // same as 'x*'
|
|
|
|
/(?:x?)+/ // same as 'x*'
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,javascript]
|
2021-08-31 16:57:18 +02:00
|
|
|
----
|
|
|
|
/x*/
|
|
|
|
----
|
|
|
|
|