invalid range error when using dasherize()
dwayne-mss opened this issue · comments
While testing an application built with Elm, I came across an error triggered by using the dasherize() method. It seems that the RegEx [_-\\s]+
used in the method is not a legitimate expression in many languages and javascript parsers written in those languages throw an exception when executing this code because the -
is seen as part of an invalid range terminated by a character group.
I'm not sure of all of the use cases, but ECMAScript seems to interpret the expression as a range without an end. But it also seems that the desired behavior (as I see it) could also be achieved using the RegEx
[_\\s-]+
or even
[_\-\\s]+"
so that the "-" is not interpreted as a range. But it might be the case that an open ended range is required for some cases, though a range that begins with "_" seems like it would match nearly everything.
I'm not certain, so opening an issue.