Hi,
I'm trying to use Regular Expressions for my smiley code in my CMS script, but have ran into some trouble.
The problem is, that it only replaces 1 of each type of smiley on the page (so if there are multiple of the same smilies, it wont work)
Here's the code i'm using...
$smileyfrom[] ='/(((>[^<]*)|(^[^<]*))([\s\n\r]|^))('.
str_replace('|','\|',
quotemeta(
str_replace('<', '<',
str_replace('>', '>',
str_replace('\/', '\\\/', $smilies[$i]
)
)
)
)
)
.')/si';
The above is put in a loop that passes through every smiley text representation in the database for example , :-),
, :-( it is then later on replaced using:
$text = preg_replace($smileyfrom, $smileyto, $text);
Any help is greatly appreciated!
Thanks in advance...