使用preg_replace()时出错

I'm trying to run the following code.

// Do the replace
$row->text = preg_replace("#{".$this->plg_tag."}".$tagcontent."{/".$this->plg_tag."}#s", $plg_html, $row->text);

// end foreach

But, i get this warning.

Warning: preg_replace() [function.preg-replace]: Unknown modifier '{' in /home/girmag/public_html/plugins/content/jw_sigpro/jw_sigpro.php on line 510

Can someone help?

Shot in the dark due to lack of information, but my guess is that either $this->plg_tag or (more likely) $tagcontent contains a # which is causing the problem because... well, that's your delimiter!

Try this:

preg_replace("(\{(".preg_quote($this->plg_tag).")\}"
        .preg_quote($tagcontent)."\{/\1\})s", $plg_html, $row->text);