I want to apply the regex to extract only the values. I am not getting the perfect one any help
[{"name":"basket ball"},{"name":"foot ball"},{"name":"sports"}]
I want to apply the regex to extract only the values. I am not getting the perfect one any help
[{"name":"basket ball"},{"name":"foot ball"},{"name":"sports"}]
There's absolutely no need for a regex here. Use json_decode():
$string = '[{"name":"basket ball"},{"name":"foot ball"},{"name":"sports"}]';
$data = json_decode($string, true);
now you have a normal php array $data
to get your wanted data from.
like
echo $data[0]['name']; // basket ball