pdheady
asked on
PHP preg_replace help
Back again....need to fix the output of this example using preg_replace:
href="$http_site_root/comp anies/one. php?compan y_id=1643" >
to this:
href="xrms/companies/one.p hp?company _id=1643" target="_blank">
want to add the target to open a new window.
href="$http_site_root/comp
to this:
href="xrms/companies/one.p
want to add the target to open a new window.
ASKER
Well it's more like this.
$data2 .= preg_replace('#\$http_site _root#', '/xrms', $data);
$data3 = preg_replace('#company_id= "(.*)"#',' company_id ="$1" target="blank"', $data2);
echo $data3;
$data2 .= preg_replace('#\$http_site
$data3 = preg_replace('#company_id=
echo $data3;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that did not work.
ASKER
my bad, i didnt output it correctly. works like a charm now! thanks.
echo str_replace(array('$http_s ite_root', '>'),array ( '/xrms',' target="_blank">'), $data);
echo str_replace(array('$http_s
ASKER
echo preg_replace('#company_id=