我在PHP wordpress重写代码中添加了正则表达式
(.*)-newfoundland-and-labrador-([^\/-]*)-(.*)$
我正在将以下字符串与此
匹配privatelisting-newfoundland-and-labrador-chevrolet-cobalt
我期待跟随匹配的参数
1. `privatelisting`
2. `chevrolet`
3. `cobalt`
但我正在关注
1. `privatelisting`
2. `and`
3. `labrador-chevrolet-cobalt-asdasd`
它看起来像正则表达式从右到左执行。
Wordpress看起来像
$newrules['car-ads/(.*?)-newfoundland-and-labrador-([^\/-]*?)-(.*?)$'] = 'index.php?pagename=car-search&city=$matches[1]&province=newfoundland and labrador&make=$matches[2]&model=$matches[3]';
请帮忙。