Jan 4, 2012, 8:24 AM
Post #1 of 3
Nested string splitting using multiple separators ?
I'm looking for a smart way to split up a string in an nested manner using multiple field separators. An example of a string I would like to split is:
$string = "flintstones,jetstones,#fred,barney,wilma,dino#";
The split patterns I would like to use for this example are [#,]. The split should be executed using the specified patterns in preceeding order.
The resulting array should contain 3 elements and should look like:
@a = ("flintstones", "jetstones", "fred,barney,wilma,dino");
Thank you in advance for your help!!