Ver Mensaje Individual
  #15 (permalink)  
Antiguo 25/02/2011, 14:59
elecs
 
Fecha de Ingreso: julio-2010
Mensajes: 17
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Problema al reemplazar cadenas

me sigue dando error:

Warning: preg_replace() [function.preg-replace]: Unknown modifier 'C' in /home/elecsvz/public_html/user/borrar_post.php on line 24

les voy a poner el ejemplo:

valor de $datos[12] ="<div id="25022011105934" style="width:500px; text-align:justify; left:50%; margin-left:-250px"><a id="25022011105934_a" href="javascript:void(0)" onclick="borrar('25022011105934')"><img src="http://cdn.iconfinder.net/data/icons/function_icon_set/cancel_48.png" height="20" width="20" style=" position:absolute; margin-left:-25px"></a>dhfgd<div style="text-align:right"><strong>25/02/2011 10:59 am</strong></div></div><hr color="#CCCCCC" style="margin-bottom:10px; margin-top:10px"><div id="25022011105927" style="width:500px; text-align:justify; left:50%; margin-left:-250px"><a id="25022011105927_a" href="javascript:void(0)" onclick="borrar('25022011105927')"><img src="http://cdn.iconfinder.net/data/icons/function_icon_set/cancel_48.png" height="20" width="20" style=" position:absolute; margin-left:-25px"></a>hGdh<div style="text-align:right"><strong>25/02/2011 10:59 am</strong></div></div><hr color="#CCCCCC" style="margin-bottom:10px; margin-top:10px">"

como pueden ver tiene varios caracteres en mayusculas y minusculas, comillas dobles, comillas simples, comas, mayores que, menores que, links y como los id de los div son dinamicos no puedo manerjarlo por CSS.

valor de $code despues de pasarlo por addslashes ="<div id="\&quot;25022011105934\&quot;" style="\&quot;width:500px;" text-align:justify;="" left:50%;="" margin-left:-250px\"=""><a id="\&quot;25022011105934_a\&quot;" href="\&quot;javascript:void(0)\&quot;" onclick="\&quot;borrar(\'25022011105934\')\&quot;" ><img src="\&quot;http://cdn.iconfinder.net/data/icons/function_icon_set/cancel_48.png\&quot;" height="\&quot;20\&quot;" width="\&quot;20\&quot;" style="\&quot;" position:absolute;="" margin-left:-25px\"=""></a>dhfgd<div style="\&quot;text-align:right\&quot;"><strong>25/02/2011 10:59 am</strong></div></div><hr color="\&quot;#CCCCCC\&quot;" style="\&quot;margin-bottom:10px;" margin-top:10px;\"="">"

la linea 24 es:

$newCode = preg_replace("#(.*?)" . $code . "(.*?)#is", "\\1\\2", $datos[12]);

y como no son valores fijos tienen q estar contenidos en variables...