View Full Version : Help with preg_replace and HTML comments

07-09-2007, 04:31 AM
Hi everyone,
i need help writing a parser to replace <!-- $word --> with <img alt="tag_$word" src="images/exe.gif" class="FCK__TemplateTag" /> and then back again. Long story short i need this to parse input from FCKeditor to replace these image tags with our template systems inbuilt tags (which are just HTML comments). The reason i'm using image tags is because i needed a "marker" in FCKeditor's HTML view to show that a tag exists there (if i just let them insert html comments, they can't see it in the HTML view of the editor - and this is a problem for our HTML illiterate support staff).

i figured i'd be using preg_replace for such a task.. but my regular expression mastery just isn't at this level yet.

Thanks in advance for any help you guys can come up with! :D