From: James Edward Gray II Date: 2006-09-15T09:13:39+09:00 Subject: Re: Newbie regexp question On Sep 14, 2006, at 6:37 PM, James Calivar wrote: > What can I replace the simple copy statement (output_file << line) > with > in order to get what I want? My wife, Dana Gray, is still learning Ruby so I gave her this problem as a test. ;) She suggests the code below. James Edward Gray II DATA.each do |line| line =~ /^(\w)\s+(\S+)\s+(\S+)\s+(.+)/ p [$1, $2, $3, $4] end __END__ R [01] R1 The system shall support "emergency call processing" R [02] R1 The system shall support "local call processing" R [08] F The system shall provide a command-line user interface R [723] F The system shall provide 6 10/100/1000 Ethernet interfaces R [11] F The system shall support VoIP networks R [398] R1 The system shall contain 2 control boards O [327] I The system should support hotswapping of all internal boards R [19] I The system shall be able to detect transmission errors R [631] F The system shall continue processing data as long as a call is active.