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", ], ]
2.1m questions
2.1m answers
60 comments
57.0k users