Skip to content

invalid range error when using dasherize() #46

Description

@dwayne-mss

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions