== Why is this an issue?

Character classes in regular expressions will match any of the characters enclosed in the square brackets (`[abc]` will match `a`, `b` or `c`). 

You can specify a range of characters using a hyphen (`-`). If the hyphen appears as the first or last character, it will be matched as a literal hyphen.

An empty character class (`[]`) will not match any character because the set of matching characters is empty. So the regular expression will not work as you intended.

[source,javascript,diff-id=1,diff-type=noncompliant]
----
/^foo[]/.test(str); // Noncompliant: always returns "false"
----

Use a non-empty character class or a different regular expression pattern that achieves the desired result.

[source,javascript,diff-id=1,diff-type=compliant]
----
/^foo/.test(str);
----

== Resources

=== Documentation

* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes[Character classes]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions[Regular expressions]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Rework this empty character class that doesn't match anything.

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
