From: Robert Dober Date: 2007-05-16T01:11:00+09:00 Subject: Re: Regex html On 5/15/07, M. R. wrote: > Hi everybody > > I want to filter the content of a body-Tag in html. How can I do this > with regular expression? > > > @h = Net::HTTP.new(url, 80) > @response = @h.get(file, nil) > > if response.message == "OK" > @body_content = response.scan(/..................../).to_s First a general remark! you should use multiline mode as tags can be more lines. Now I do not really see what you want from your page. If you want the body tag only, the following should do @response.gsub(/\s+/," ").scan(/]*>/) this might be slow for long pages Regexen are probably not your best choice if you want to analyze the tag. Still something like this might work fine @response.gsub(/\s+/," ").scan(//) save for escaped " HTH Robert > end > > > thx for your solution! > ribit > > -- > Posted via http://www.ruby-forum.com/. > > -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw