我需要帮助创建正则表达式
blah blah blah blah <?= __l(array('key'=>'SOMEVALUE','default'=>'string string string')) ?>blah blah
我希望能够剥离 'SOMEVALUE' 和 'string string string'
提前致谢
====== '这就是我所拥有的' ========
$subject = "Blah blah ja ja blah blah jank junk jonk <?= __l(array('key'=>'KEYKEYKEY','default'=>'I am a monkey sigh\'s')) ?> ldjlsakfdj as;dfj as;flkj a fsd ljaasfd <?= __l(array('key'=>'KEYKEYKEY','default'=>'I am a monkey sigh\'s')) ?> ";
$pattern = '#\_\_l\(array\(\'key\'=>\'(.*)\',\'default\'=>\'(.*)\'\)\)#';
if (preg_match_all($pattern, $subject)) {
print "A match was found.";
} else {
print "A match was not found.";
}
print '<br />';
preg_match_all($pattern, $subject, $matches);
echo '<pre>';
print_r($matches);
echo '</pre>'