re = /\-(((ae|as)|(ge|et|xe)\-\d\/\d\/)\d+(:\d){0,1}\.\d+)/
str = 'policerdrop-bs.[lim2m-xe-0/0/1.10106-inet-i]
policerdrop-bs.[lim256k-ge-2/0/0.159-inet-i]
policerdrop-bs.[lim256k-ae2.159-inet-i]
policerdrop-bs.[lim2m-xe-0/0/1:0.10106-inet-i]
policerdrop-bs.[limbw-1m-xe-1/0/0.6027-inet-i]'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html