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 :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates