Uploaded image for project: 'ClojureScript'
  1. CLJS-1320

clojure.string/split adds separator matches & failed matches (nil) when the separator is a regex with alternation

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: 0.0-3308
    • Fix versions: None
    • Labels:
      None

      Description

      I want to split a string on "; ", and optionally discard a final ";". So, I tried:

      (clojure.string/split "ab; ab;" #"(; )|(;$)")
      

      In Clojure, this does what I want:

      ["ab" "ab"]
      

      In ClojureScript, I get:

      ["ab" "; " nil "ab" nil ";"]
      

      I'm not sure to what extent this is a platform distinction and to what extent it's a bug. Returning nils and seperators from clojure.string/split's output seems like it's against string.split's contract?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lvh lvh
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: