Frage

Is there anyway to do preg_replace with that:

<p style="background:white">
<span style="font-size:10.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;">
Coût de la prestation : 43.19 . <u></u><u></u></span></p>

I just want to remove or leave with spaces the price. I don't know how to define the pattern and the replacement expressions.

Hope anyone helps me!

TY.

EDIT: I just want to remove the 43.19 ., being just Coût de la prestation :

War es hilfreich?

Lösung 2

Finally what worked was:

preg_replace('#(Coût\s+de\s+la\s+prestation)\s*:\s*\d+(\.\d+)?#u', '$1:', $body);

Thanks to all.

Andere Tipps

Did you try the u modifier?

Something like:

preg_replace('/Coût de la prestation : (\d+\.\d{2})/u', 'whatever', $str);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top