alecthorne Posted October 28, 2012 Share Posted October 28, 2012 I am a total beginner at php, and have found a need for preg_match. Even after looking through posts here, this example is still rather beyond me. Can someone point me in the right direction. I have a string $params with the content as below. { "metadata.title": "", "metadata.description": "", "metadata.keywords": "", "metadata.robots": "", "metadata.author": "", "config.enable_comments": "0", "config.primary_category": "311" } How can I extract the value between the "" after the primary_category, in this case 311. Thanks, Alec Link to comment https://forums.phpfreaks.com/topic/269993-beginners-php-question-preg_match/ Share on other sites More sharing options...
trq Posted October 28, 2012 Share Posted October 28, 2012 You don't need any regular expression, see json_decode. Link to comment https://forums.phpfreaks.com/topic/269993-beginners-php-question-preg_match/#findComment-1388229 Share on other sites More sharing options...
alecthorne Posted October 29, 2012 Author Share Posted October 29, 2012 Thank you very much!! Worked a treat, and so simple when you know how. Thanks, Alec Link to comment https://forums.phpfreaks.com/topic/269993-beginners-php-question-preg_match/#findComment-1388536 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.