Segment string into array, regex?

Posted by Hanpan on Stack Overflow See other posts from Stack Overflow or by Hanpan
Published on 2010-03-23T12:38:32Z Indexed on 2010/03/23 12:43 UTC
Read the original article Hit count: 240

Filed under:
|

I have a string which looks like this:

"[segment1][segment2][segment2]"

What I'd like is to be able to split the string into an array, so I'd end up with:

Array[0] = "segment1", Array[1] = "segment2", Array[2] = "segment3"

I've tried using the string split function, but it doesn't seem to do exactly what I want. I was wondering if anyone has some regex which might help me out?

Thanks in advance

© Stack Overflow or respective owner

Related posts about regex

Related posts about python