Click to See Complete Forum and Search --> : PHP regular expression insert at beginning of line


HighOrbit
03-31-2003, 01:40 PM
I am having a brain lock.. so I hope somebody can help me here.

I have a string that contains new lines.

$string="data \ndata\ndata"

I want to insert some stuff at the beginning of every line so that the string will be changed to:

$string="MAN**data \nMAN**data\nMan**data"

I've tired a few different combinations with ereg_replace but I can't get it right.

Can anybody help me?