I have a string like the following.
ids = 'S1486S1485E444'
I want to split it into an array of parts separated by the S or E like the following.
["S1486", "S1485", "E444"]
This is what I came up with but it gives the undefined and empty strings as well.
ids.split(/(S+\d+)|(E+\d+)/)
["", "S1486", undefined, "", "S1485", undefined, "", undefined, "E444", ""]
Or just do a match: