I have string :
$string = 'ABCCDF[GH]IJJ[KLM]';
How to i get string 'GH' and 'KLM' in php
I think i will use preg_split, but I know not more about reg. Plz help me.
Try this;
>>> $string = 'ABCCDF[GH]IJJ[KLM]'; => "ABCCDF[GH]IJJ[KLM]" >>> preg_match_all('/[(w+)]/', $string, $matches); => 2
$matches will look like below.
$matches
[ [ "[GH]", "[KLM]", ], [ "GH", "KLM", ], ]
1.4m articles
1.4m replys
5 comments
57.0k users