To get rid of all tags:
rereplacenocase("<[^<]*>",variable,"all")
This regular expression searches for all patterns that begin with a <, have something in the middle that's not a < and end with a >.To get rid of image tags only:
rereplacenocase("<img[^<]*>",variable,"all")
This expression is same as previous, except it searches for patterns beginning with <img.To get rid of two or more specific tags:
rereplacenocase("<(img|/?div|br)[^<]*>",variable,"all")
This expression searches for patterns beginning with <img, <div, </div or <br. The reason I'm using * instead of a + is because closing tags don't have characters between the beginning pattern and the ending pattern.
what are image tags?
ReplyDelete<img src="url" alt="image description" /> ;-)
ReplyDeleteo, lol, I knew what am image tag was I just didn't make the connection.
ReplyDeletebut I don't get the whole outputting RSS feed that contains tags, why would you want to take out the images?
Because when you're outputting partial feeds, like mike in midwood on his blogroll, if you have image tags, they will render.
ReplyDeleteahh I see, so your saying that by MikeInMidwood's blog roll because its a partial feed it will give anything that's in the beginning of the post, even if its an image?
ReplyDeleteYah, so the programmer needs to make sure to strip out images and generally all tags, unless he wants to keep bold, italic and maybe titles.
ReplyDeleteInteresting.
ReplyDeleteI have never seen images on it and the babysitter has an image at the beginning of every post.
ReplyDeleteDude, this is a programming post, not general post, hence the title. For programmers, not for users.
ReplyDeleteMikeInMidwood: he isn't talking about your blog posts. He's talking about your Blog Roll.
ReplyDeletebut wait
Moshe: he's right I do have an image by every post. Since he hasn't removed the image tag, then how come no image shows up in his blog roll thing?
Again, if you don't understand what the title says, don't know what rereplacenocase is and don't know what regular expressions are, this post is not for you. And the tags for this post are "programming" and "coldfusion".
ReplyDeleteHa, my knowledge of programming extends just until the "font color=" part. Sometimes, I admit, I dabble in *gasp* "bold"
ReplyDeleteAnyway, Mr. Programmer, I didnt understand a word of this post, and therefore I'm going to assume that it's a really deep, thought out post. I'll recommend it to friends
ya nye panimayu
ReplyDeletei can't even tell what language you are speaking altogether
tormoz
ReplyDeletecoldfusion and regexp, duh.
Mo, check ur facebook inbox please.
ReplyDeleteOk, thats fair play, but say you are pulling from a feed and you do want to keep an image, but only 1 to keep the formatting in place. eg, you pull in the rss through cfhttp, drop it to xmlcontent and find out that within the description.xmltext you got 8 photos pulling through that just looks naff, what regex can you do to only remove all apart from the first one?
ReplyDeleteNot sure. What you can do is look for first occurrence, use mid() to grab everything after that and use the regexp on that substring. Then concatenate them back together.
ReplyDeleteFound this handy tag http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=425
ReplyDeleteallows me to do it very nicely
Fantastic help. Thanks.
ReplyDelete