From: Max Benjamin Date: 2006-07-24T01:17:49+09:00 Subject: Re: strip tags? Daniel Baird wrote: > On 7/23/06, Andreas S. wrote: >> >> Daniel Baird wrote: >> > On 7/23/06, Stefan Scholl wrote: >> >> A regex isn't always the _best_ way to deal with markup >> >> languages, but for an _easy_ way it's good enough. >> > >> > the problem is, it's not always the _correct_ way. >> >
>> >> This is no correct HTML, < and > have to be encoded as entities. > > > That is true.. if the original poster has the luxury of only dealing > with > correct html, he's a lucky fellow, and can kludge up some regexen that > will > do the job. Even in a well-coded site, it's not unthinkable that you > could > forget to do some encoding and end up with angle-brackets inside a > textarea > or something, though. > > How useful a regex approach is depends on the data. I have used a bit > of > regex-type html parsing before and it worked fine, for the data that I > was > parsing. Horses for courses. > > ;D Thanks for the quick replys. I should have been more explicit in my question. I want to strip html tags in order to sanitize form input. I'm a bit of a ruby noob and I was hoping to find a function similar to PHP's strip_tags, one that would remove both html and ruby code. Best -- Posted via http://www.ruby-forum.com/.