Skip to content

Regex.split gives RangeError when regex matches a zero length string #18

@jakub-nlx

Description

@jakub-nlx
import Regex

re = Regex.fromString >> Maybe.withDefault Regex.never

Regex.split (re "\\b") "foo bar"

gives

RangeError: Invalid array length
at Array.push ()
at _Regex_splitAtMost (:11:7)
at :1:1

Other examples:

  • Regex.split (re "d?") "foo bar"
  • Regex.split (re "") "foo bar"

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