Forum: Ruby Strinpping html using regexp

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
19eb75164135659a8fae98101b1c250e?d=identicon&s=25 Arun Kumar (arun_nss)
on 2009-05-05 16:38
Hi,
   I want to remove the all html tags in a string using regexp. But the
main thing is I dont want to use gsub or any other methods for it. I
want pure regexp to fetch the data other than the html tags. Can anybody
please give me the code.

Thanks
Arun
245a6d22816ecaeac1c9080ad183b859?d=identicon&s=25 badboy (Guest)
on 2009-05-05 16:41
(Received via mailing list)
Arun Kumar schrieb:
> Hi,
>    I want to remove the all html tags in a string using regexp. But the
> main thing is I dont want to use gsub or any other methods for it. I
> want pure regexp to fetch the data other than the html tags. Can anybody
> please give me the code.
>
> Thanks
> Arun
1. regular expressions are not good for stripping html code, use a HTML
Parser
(Nokogiri, Hpricot, ...)
2. if you want to use regexp, why not gsub? o_O what do you mean by
"pure
regexp"? gsub can strip content based on regular expressions. I don't
get your
point here.
3. ....
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-05-05 16:51
Arun Kumar wrote:
> Hi,
> But the
> main thing is I dont want to use gsub or any other methods for it.
>

In what programming language can you use a regex to find a match without
calling a method?
134ea397777886d6f0aa992672a50eaa?d=identicon&s=25 Mark Thomas (Guest)
on 2009-05-05 23:06
(Received via mailing list)
On May 5, 10:38 am, Arun Kumar <arunku...@innovaturelabs.com> wrote:
> Hi,
>    I want to remove the all html tags in a string using regexp.

No, you really really don't. Trust me.

> I want pure regexp to fetch the data other than the html tags.

If you had said "pure XPath", then that would make sense.

-- Mark.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-05-06 00:15
Mark Thomas wrote:
> On May 5, 10:38�am, Arun Kumar <arunku...@innovaturelabs.com> wrote:
>> Hi,
>> � �I want to remove the all html tags in a string using regexp.
>
> No, you really really don't. Trust me.
>

Yes, yes, he really does.  This is an ongoing line of questioning dating
back several weeks.
This topic is locked and can not be replied to.