Jump to content

Preg_replace()


shadowayex

Recommended Posts

I'm new to preg_replace() and I got a few small scale examples to work, but I can' seem to get my purpose for using it to work.I'm building a file editing system for my website and everything. It's working so far except for one little bug that involves when I try to open a file with a textarea in my system. Of course the ending </textarea> tag is closing the textarea I'm working in. I figured I'd try using a preg_replace() to replace </textarea> with [/textarea] (or something similar) and then change it back when the file is saved. Well, it didn't work. Apparently preg_replace() ignores < and > so those aren't removed, thus kind of ruining my plan. I've thought of ways around this (such as possibly searching for "/textarea" and changing it to "/txtarea" and back) but I wanted to see if there's a way to search and replace full tags instead, because I will be using preg_replace in a small scale BB code converter type dealie :). So if there's a certain way to handle < an d> in preg_replace(), please let me know.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...