Most likely a preg_replace question?
It's hard to explain so i'll provide an example:
If someone types "/me says hello" in a textbox, how can i parse this (using preg_replace) so that it will be displayed as:
<font color="red">* da_silvy says hello</font>
In a shoutbox?
Can someone please tell me the code for this :D
Re: Most likely a preg_replace question?
Quote:
Originally posted by da_silvy
It's hard to explain so i'll provide an example:
If someone types "/me says hello" in a textbox, how can i parse this (using preg_replace) so that it will be displayed as:
<font color="red">* da_silvy says hello</font>
In a shoutbox?
Can someone please tell me the code for this :D
Code:
$string = preg_replace("/\me(*.)/\n", '<font color="read">' . $username . '\\1</font>', $string);
I'm not sure how to fit the newline in there, though. :(
If I you haven't gotten a proven answer by the time I get home from school, I'll give it a shot.