String text = \'[[\"item1\",\"item2\",\"item3\"], [\"some\", \"item\"], [\"far\", \"out\", \"string\"]]\';
I would like to iterate over each individual
You need to build a parser by hand. It's not hard, but it will take up time. In the previous comment you said you want an ArrayList of ArrayList... hmmm... good
Just parse the string char by char and recognize each token by first defining recursive parsing rules. Recursive descendant parser rules are usually graphical, but I can try to use ABNF for you
LIST = NIL / LIST_ITEM *( ',' SP LIST_ITEM)
LIST_ITEM = NIL / '[' STRING_ITEM *(, SP STRING ITEM) ']'
STRING_ITEM = '"' ANYCHAR '"'
SP = space
ANYCHAR = you know, anything that is not double quotes
NIL = ''
Another approach is to use Regular Expressions. Here are a couple of samples. First capture outer elements by
(\[[^\]]*\])
The above regex capture everything from '[' to the first ']', but you need to modify it or cut the brackets from your string (just drop first and last char)
Then capture inner elements by
(\"[^\"]\")
Simple as the above