html - preg_replace remove only part of a string but leave the rest using PHP -


I'm trying to replace in PHP in a string. How do you delete part that is only in group in PHP?

& lt; Font. + (Size. +?.) & Gt;

I want to delete size = x, where ever inside. The problem is that I

  $ text = preg_replace ("& lt?? + (Size +? ..)>", "", $ text);             255, 0 ); "Size =" 2 ">   text  gt; & lt; / strong> & lt; / font & gt; & lt ; Font size = "2" & gt; more text   

in

    Text    

I'm trying to say where there is a font tag and if I resize I see - anything removes the properties of the shape, but leave it all intact.

Not the best solution, but the answer to your question:

  $ html = & lt; & Lt; & lt; END & lt; font style = "background color: RGB (255, 255, 0); "Size =" 2 ">   text  gt; & lt; / strong> & lt; / font & gt; & lt ; Font size = "2"> more text  end; $ Text = preg_replace ('/ (& lt; font. *?) (Size \ s * = [^ \ s & gt; ;] *) ([^ & Gt;] *) & gt; / SI ',' 1 \ 3>, $ Html); var_dump ($ text);  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -