Gossamer Forum
Home : General : Internet Technologies :

preg_replace question

Quote Reply
preg_replace question
Can a person use preg_replace to add tags around the first character in a string?

Something like $message = preg_replace(%, <big>%</big>, $message, 1); ?

I've never used this function so I'm not sure about what it can and cannot do. I know the syntax for that statement isn't correct, just out there so you know what I mean.
Quote Reply
Re: [JoFrRi] preg_replace question In reply to
Its been a while since I played with PHP, but I believe you can do something like;

$message = preg_replace("/^([a-z]{,1}?)/i", "/<big>$1</big>/", $message);

Basically, its similar to how you would do it in Perl :)


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!