re = /(?i)[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}/m
str = 'e876c866-1dd6-4c32-bf27-7ab673b57f75
d9da6fe0-cf69-40ae-9263-a115aac94441
bc783e58-3cac-4efb-92ee-560b696674c8
7b054304-c5dd-4595-a390-fd4f4b700e33
20255eea-5679-4fa7-8e65-4bab69425727
8039e4c6-4032-4065-8723-b0351d4a33f0
e9b3f927-b87a-459a-8a5b-caba3ccc8968
edbdb831-6e92-4241-8ba9-0bba71a1d7b0
087b5b52-97e6-4341-8976-59674ecbef2d
d78be4c5-a0ba-4ef4-ab77-97585aa61436'
# 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