samedi 19 avril 2014

PHP modify multiline string


Vote count:

0




I have a multiline string like the following:



ABCDEF
Colore lato A: NO
Colore lato B: Colore lato B (+3,00)
Colore lato C: NO
Stampa lato A: Stampa lato A (+7,00)
Stampa lato B: NO
Stampa lato C: NO
blablabla
blablabla


basically I would like to make these changes: - Remove all lines starting with 'Colore' or 'Stampa' and end with 'NO' - Remove the part before ":" lines starting with 'Colore' or 'Stampa'


then the result I would like is the following:



ABCDEF
Colore lato B (+3,00)
Stampa lato A (+7,00)
blablabla
blablabla


For various reasons I can not turn it into array and modify it.


I use regular expressions but I have not found the correct one, you have some idea?


Thank you!





asked 50 secs ago






Aucun commentaire:

Enregistrer un commentaire