Creating an array of values from a combination of range and list values

Today's UDAMAN award goes to Badger! A couple of minor tweaks to work inside a bash string (I'm using a bash script to create the conf file programatically) and rename of the the zip field to the incomming ziparea field and it's golden. I owe you a beer now :-).

Here's the section in the resulting conf file for reference:
ruby {
code => "zip_area =
split_zip = event.get('ziparea').split(',')
split_zip.each { |ziparea|
if ziparea.length == 3
zip_area << ziparea
else
split_zip = ziparea.split('-')
beg_zip = split_zip[0].to_i
end_zip = split_zip[1].to_i
for z in beg_zip...end_zip + 1 do
zip_string = z.to_s
for i in zip_string.length...3 do
zip_string = '0' + zip_string
end
zip_area << zip_string
end
end
}
event.set('zipAreas', zip_area)
"
}