You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a web developer approaching Elm from Javascript, I expect regexes and associated functions to behave the same as in JS.
Issue: In Elm 0.18 Core/Regex, an expression containing capture groups would splice captures into the returned array. In Elm 0.19 Regex, the capture groups are omitted.
If separator is a regular expression that contains capturing parentheses, then each time separator is matched, the results (including any undefined results) of the capturing parentheses are spliced into the output array.
Examples:
---- Elm 0.19.0 ----------------------------------------------------------------
Read <https://elm-lang.org/0.19.0/repl> to learn more: exit, help, imports, etc.
--------------------------------------------------------------------------------
> import Regex
> Regex.split (Maybe.withDefault Regex.never <| Regex.fromString ",") "a,b,c,d"
["a","b","c","d"] : List String
> Regex.split (Maybe.withDefault Regex.never <| Regex.fromString "(,)") "a,b,c,d"
["a","b","c","d"] : List String
---- elm-repl 0.18.0 -----------------------------------------------------------
:help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> import Regex exposing (regex, HowMany(All))
> Regex.split All (regex ",") "a,b,c,d"
["a","b","c","d"] : List String
> Regex.split All (regex "(,)") "a,b,c,d"
["a",",","b",",","c",",","d"] : List String
// This was run in Chrome 69
console.log("a,b,c,d,e".split(/,/));
console.log("a,b,c,d,e".split(/(,)/));
VM59:1 (5) ["a", "b", "c", "d", "e"]
VM59:2 (9) ["a", ",", "b", ",", "c", ",", "d", ",", "e"]
The text was updated successfully, but these errors were encountered:
As a web developer approaching Elm from Javascript, I expect regexes and associated functions to behave the same as in JS.
Issue: In Elm 0.18 Core/Regex, an expression containing capture groups would splice captures into the returned array. In Elm 0.19 Regex, the capture groups are omitted.
Justification: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split#Description
Examples:
The text was updated successfully, but these errors were encountered: