$ node
> "ababaabab".split(/a{2}/)
[ 'abab', 'bab' ]
> "ababaabab".split(/(a){2}/)
[ 'abab', 'a', 'bab' ]
>
So, this doesn't make sense to me. Can someone explain it? I don't get why the 'a'
shows up.
Note: I am trying to match for doubled line endings (possibly on windows files) so I am splitting on /(\r?\n){2}/
. However I get extraneous '\015\n'
entries in my array (note \015 == \r
).
Why are these showing up?
Note: also affects JS engine in browsers so this is specific to JS not node.