[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: [NEWBIE] Extract all occurences from a text
From:       Szymon Drejewicz <drejewic () wsisiz ! edu ! pl>
Date:       2004-04-23 12:19:04
Message-ID: c6b0hk$ua6$1 () portraits ! wsisiz ! edu ! pl
[Download RAW message or body]

My favourite method for extracting regexps and processing them is gsub()
with block:

File.open("fileName.html","r").readlines.join.each_line do |line|
        line.gsub(/yourPattern/) do |match|
                ...do something with 'match'
        end
end

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic