I need some way of capturing the text outside square brackets. So for example, the following string:
       My [ground]name[test]Jhon[random]petor [shorts].
I m using the below preg match expression but the result could not be expected
    preg_match_all("/\[[^\]]*\]/", $text, $matches);
it giving me the result which is within the square bracket.
    Result : 
     Array ( 
            [0] => [ground] 
            [1] => [test] 
            [2] => [random] 
            [3] => [shorts] 
        )
Expect Output:
       Array ( 
            [0] => [My] 
            [1] => [name] 
            [2] => [Jhon] 
            [3] => [petor] 
        )
Any help that would be great
 
    