这就是我为我的 RegEx 所做的,我想知道这是否是最好的方法。
无论标识符之间的间距如何,我都希望能够找到类似的东西,并且不区分大小写。如果可能的话,不要担心订单..
例子:
[Foreclosure ="Remax" URL="http://www.remax.com" Title = "4 Bedroom 2 Bath Condo"]
[Foreclosure ="Remax"URL="http://www.remax.com"Title="4 Bedroom 2 Bath Condo"]
[Foreclosure = "Remax" URL="http://www.remax.com" Title = "4 Bedroom 2 Bath Condo" ]
这是我现有的代码:
function ForeclosureCode_filter( $buffer )
{
//There might be a better way to do the regex... But this seems to work...
$buffer = preg_replace_callback( '@\[Forclosure *=*"(.*?)" *url *=*"(.*?)" *title="(.*?)" *\]@si',
"ForeclosureCode_replace", $buffer );
return $buffer;
}