Stedwick
1/21/2008 10:33:00 PM
On Jan 20, 4:38 am, William James <w_a_x_...@yahoo.com> wrote:
> On Jan 19, 10:39 pm, William James <w_a_x_...@yahoo.com> wrote:
>
> > text = IO.read("episode_guide.html")
> > a = text.scan(/<p>\s*stardate:[ a-z.\d]*(.*?)<\/p>/mi).flatten.
> > map{|s|
> > s.strip.gsub(/ /," ").gsub(/<.*?>|&[^;]+;/m,"").
> > gsub(/\s+/, " ") }
> > puts a.join("\n\n")
> > puts
> > puts a.size
>
> Corrected:
>
> text = IO.read("episode_guide.html")
> a = text.scan(/<p>\s*stardate:[ a-z.\d]*(.*?)<\/p>/mi).flatten.
> map{|s|
> s.gsub(/ /," ").gsub(/<.*?>/m,"").gsub("'","'").
> gsub(/\s+/, " ").strip }
> puts a.join("\n\n")
> puts
> puts a.size
I'm liking yours so far William :-) It's pretty elegant.