Sorry for my dumb question but I'm a rubyist and this is the first time I use php. I must clean using preg_replace some HTML code.
This is a sample piece of code:
<span style="font-size: 13pt; color: rgb(85, 85, 85); font-family: helvetica; font-weight: bold; line-height: 17pt;">Come funziona il segnale televisivo?</span><br>
Per capire cosa sono i 100 Hz e i 200 Hz dobbiamo fare un passo indietro e capire come funziona il sistema televisivo. "Interlacciato" indica il modo in cui queste linee vengono usate per comporre un fotogramma, ovvero una singola frazione d'immagine: <strong>anziché mostrare un fotogramma intero da 576 linee, quando il segnale è interlacciato vengono mostrati rapidamente e in successione le 288 linee pari e poi le 288 linee dispari.</strong> Il totale è sempre 576 ma, al posto di avere un solo fotogramma, avremo due mezzi-fotogrammi, chiamati tecnicamente semiquadri, che contengono la metà della risoluzione totale. Susseguendosi rapidamente, questi semiquadri ingannano l'occhio umano che li percepirà come un unico frame, ma si tratta sempre di 288 linee pari seguite da 288 linee dispari. Il disegno sotto aiuta a capire il concetto.<br>
</span>
</p>
<p style="text-align: center;"><img width="560" height="375" alt="" src="http://www.dday.it/userFiles/FCK/foto1.jpg"></p>
<p>
<span style="font-size: 10pt; color: rgb(85, 85, 85); font-family: helvetica; font-weight: normal; line-height: 14pt;"> Il contrario di interlacciato è il “progressivo”: <strong>un’immagine progressiva è anch'essa composta da semiquadri, ma ciascuno di questi semiquadri è completo</strong>, quindi con 576 linee.</span>
</p>
<p style="text-align: center;"><img align="absMiddle" alt="" src="http://www.dday.it/userFiles/FCK/foto2(1).jpg"></p>
<p>
<span style="font-size: 10pt; color: rgb(85, 85, 85); font-family: helvetica; font-weight: normal; line-height: 14pt;"><br></span>
<span style="font-size: 10pt; color: rgb(85, 85, 85); font-family: helvetica; font-weight: normal; line-height: 14pt;"> Veniamo ora alla frequenza di quadro: <strong>u</strong><strong>n secondo di video è composto da 25 fotogrammi che, nel caso dell’interlacciato, sono composti a loro volta da due semiquadri</strong>: 25 moltiplicato per due fa proprio 50 Hz.</span>
</p>
<p style="text-align: center;"><img width="500" height="200" alt="" src="http://www.dday.it/userFiles/FCK/foto-3.jpg"></p>
<p>
<span style="font-size: 10pt; color: rgb(85, 85, 85); font-family: helvetica; font-weight: normal; line-height: 14pt;"><br><br></span>
</p>
</div>
When I try to update my db with a query I receive an error for the single quotes and the double quotes in my HTML. I know that I must replace single and double quotes, but If I use a regular expression like this:
$string = preg_replace("/\'/", ''', $string);
$string = preg_replace('/\"/', '"', $string);
The regex change also the quote inside my HTML tags and this broke my HTML. How can I avoid this? Is there any PHO istruction to convert only text inside tags?