I'm trying to figure out a way of using regular expressionsm specifically ereg_replace(), to take an existing string and indent it. Specifically, I'd like to take a string like
line 1\nline 2\nline 3\n
and turn it into
\tline 1\n\tline 2\n\tline 3\n
Note that I don't want a tab after the final \n. Any suggestions on the correct regex?
line 1\nline 2\nline 3\n
and turn it into
\tline 1\n\tline 2\n\tline 3\n
Note that I don't want a tab after the final \n. Any suggestions on the correct regex?