This is an edge case of clojure.string/split with limits and non-consuming assertions. ^ and $ are fully supported with the meaning of the underlying regex engine (which may be subtly different in javascript and java).
This is clearly wrong. It occurs because clojure.string/match uses the size of the match to determine where to split. Since the match is always empty, it always splits at index 0. cljs.user=> (clojure.string/split "123" #"$" 2) ["" "123"] However, I'm not sure why you consider Clojure's answers to be correct. I would expect this in Clojure: user=>(clojure.string/split "123" #"^" 2) ["" "123"] On Sunday, April 19, 2015 at 10:39:28 AM UTC-5, Dominykas Mostauskis wrote: > I am having trouble using the ^ and $ characters under Clojurescript. > Equivalent calls in Clojure work fine. Workarounds? > > Unexpected cljs behaviour: > > cljs.user=> (clojure.string/split "123" #"$" 2) > ["" "123"] > cljs.user=> (clojure.string/split "123" #"^" 2) > ["" "123"] > > Clojure works fine: > > user=> (clojure.string/split "123" #"$" 2) > ["123" ""] > user=> (clojure.string/split "123" #"^" 2) > ["123"] -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.