[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Strinpping html using regexp

Arun Kumar

5/5/2009 2:38:00 PM

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
--
Posted via http://www.ruby-....

4 Answers

Jan-Erik R.

5/5/2009 2:40:00 PM

0

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. ....

7stud --

5/5/2009 2:51:00 PM

0

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?

--
Posted via http://www.ruby-....

Mark Thomas

5/5/2009 5:22:00 PM

0

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.

7stud --

5/5/2009 10:15:00 PM

0

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.



--
Posted via http://www.ruby-....