Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di gasmor
    Registrato dal
    Apr 2004
    Messaggi
    1,768

    [REGEXP] modificare '<br>' ma non <br>

    ciao a tutti

    come faccio a far modificare solo i
    e Enbsp; racchiusi dentro gli apici (' e ") e escludere quelli al di fuori?

    es:

    $stringa = "
    Enbsp; 'questo
    e questo Enbsp;; vanno modificati' questo
    qui no. Poi modifica anche '
    Enbsp;' questi";

    e otenere:
    $stringa = "
    Enbsp; 'questo &lt;br&gt; e questo Enbsp; vanno modificati' questo
    qui no. Poi modifica anche '&lt;br&gt;E nbsp;' questi";

    :master:

    ho scritto volutamente così: Enbsp; perchè altrimenti il forum li interpreta
    Hai provato a creare un sito con Jaaxo Cms PHP5? new!

  2. #2
    Codice PHP:
    $stringa preg_replace("/\\'(\\<br\\>|\\\&nbsp\\;)\\'/e""htmlentities('\\\\1')"$stringa); 

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.