# Splitting a string with regex

**URL:** <https://forum.kirupa.com/t/splitting-a-string-with-regex/247897>\
**Category:** flash\
**Created:** [December 31, 2007, 11:48pm UTC](https://forum.kirupa.com/t/splitting-a-string-with-regex/247897 "2007-12-31T23:48:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon4341189](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@anon4341189](https://forum.kirupa.com/u/anon4341189)\
**Post date:** [December 31, 2007, 11:48pm UTC](https://forum.kirupa.com/t/splitting-a-string-with-regex/247897/1 "2007-12-31T23:48:37Z")

</div>

Hi all,

I have the following string:

```auto

/string1/string2/string3/

```

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

```auto

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

```

Currently I have the follow:

```auto

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

```

This results in:

```auto

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 🙂
