当前位置:Gxlcms > PHP教程 > 坑爹的正则,请问

坑爹的正则,请问

时间:2021-07-01 10:21:17 帮助过:9人阅读

坑爹的正则,请教
config.php

$_LANG['new_arrival'] = 'New Arrivals';
$_LANG['hot_products'] = 'Hot Products';
$_LANG['group_deals'] = 'Group Deals';
$_LANG['specials'] = "Specials";
$_LANG['after'] = 'Contact cu\'stomer


service for
order status and
other after-sales issues
';
$_LANG['group_deals'] = 'Group Deals';

$subject = file_get_contents("config.php");
$pattern = '这里正则要如何写呢';
preg_match_all($pattern, $subject, $matches);
print_r($matches);

我要取出等号后面的所有内容,正则要怎样写呢?
请注意等号后面字符串中的符号(单引号,双引号,转义符己及换行都要取到)。

结果如下:
1. 'New Arrivals'
2. 'Hot Products'
3. 'Group Deals'
4. "Specials"
5. 'Contact cu\'stomer


service for
order status and
other after-sales issues
'

分享到:


------解决方案--------------------
$subject =<<< 'TXT'
$_LANG['new_arrival'] = 'New Arrivals';
$_LANG['hot_products'] = 'Hot Products';
$_LANG['group_deals'] = 'Group Deals';
$_LANG['specials'] = "Specials";
$_LANG['after'] = 'Contact cu\'stomer


service for
order status and
other after-sales issues
';

人气教程排行