日期:2014-05-17  浏览次数:20417 次

怎么用preg_replace
$content= "sdfggfhghjkjhkhljkljkljkadhkajdhkagfkhgkhgS?Hghjlfijsflkjaslfll
fgdfhsiodghoifgiosdg   p:/6117/civ/civ-issue/6117-mff.dgn   gjfdghfgdhd
p:/6117/civ/cov-issue/6117-mff.dgn   dfghdhfdgjgfjkgkhjkh........ "
要把$content中的所有绝对路径换成相对路径,如p:/6117/civ/civ-issue/6117-mff.dgn  
换为:6117-mff.dgn  
我想用preg_replace()做但没弄出来。

------解决方案--------------------
$content= "sdfggfhghjkjhkhljkljkljkadhkajdhkagfkhgkhgS?Hghjlfijsflkjaslfll
fgdfhsiodghoifgiosdg p:/6117/civ/civ-issue/6117-mff.dgn gjfdghfgdhd
p:/6117/civ/cov-issue/6117-mff.dgn dfghdhfdgjgfjkgkhjkh........ ";

echo preg_replace( "/[a-z]:\/\S+?\//iU ", " ", $content);