Posted by tech on July 7, 2009 |
|
Let us say your string contains this data
1
| {"1":"one", "2":"two"},{"3":"three", "4":"four"},{"5":"five", "6":"six"} |
While regex can slow down performance, I decided to use it for this situation because I can do it using only a regex pattern. This regex will get all instances of a substring between two curly brackets { and }. In the example above, the result should be 3 entries since there are 3 sets of curly brackets. Please see the regular expression below.
Found this post useful? Buy me a cup of coffee or subscribe to my RSS feeds and Google Friend Connect
