Splitting a string with regex

Hi all,

I have the following string:


/string1/string2/string3/

I’d like to explode the string into the array stringArray like so:


stringArray[0] = string1
stringArray[1] = string2
stringArray[2] = string3

Currently I have the follow:


var mystr:String = "/string1/string2/string3/";
var stringArray:Array = mystr.split("/");

This results in:


stringArray[0] = 
stringArray[1] = string1
stringArray[2] = string2
stringArray[3] = string3
stringArray[4] = 

Is there anyway to get the array I want by just using regex without using any sort of array manipulations?

Thanks :slight_smile: