re = /((?:(us\-)?repository(?(1)|nocdn)?|h(?:(1)|(3)|(5)|(p))\-(?(6)webs01\-s|repo(?(3)(sitory)?01|(?(4)sitory02|(?(5)sitory03|)))\-v))|repo(?:nocdn|us)\.wip|(?:nocdn|us)\-repository\.gtm|91-228-167-25\.ptr)\.eset\.com/mi
str = 'repository.eset.com
us-repository.eset.com
repositorynocdn.eset.com
hp-webs01-s.eset.com
h1-repo01-v.eset.com
h1-repository01-v.eset.com
h3-repository02-v.eset.com
h5-repository03-v.eset.com
91-228-167-25.ptr.eset.com
nocdn-repository.gtm.eset.com
us-repository.gtm.eset.com
reponocdn.wip.eset.com
reponocdn.wip.eset.com
reponocdn.wip.eset.com
repous.wip.eset.com
'
# 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