From: "Charles L. Snyder" Date: 2005-06-10T13:15:28+09:00 Subject: newbieQ: new array from old array w regex Hi, As an exercise to learn to use Ruby, I am trying to search large xml files to extract just the zip codes from the author address nodes in the file: require "rexml/document" include REXML doc = Document.new File.new("JPS.xml") mylist2=mylist=[] doc.elements.each("RECORDS/RECORD/AUTHOR_ADDRESS") {|element| mylist.push element.text} puts mylist.each {|m| /b\d{5}-\d{4}\b|\b\d{5}\b/.match(m)} This only gives me the entire contents of the address node - how do I extract only the zip codes (preferably putting them in an array). My next step is to end up with a hash table of unique zipcodes and their frequency of occurrence... Thanks CLS