re = /^[0-9A-F]{32}$/im
str = 'fab4cc07260bc73302a2653aa2b0e6de
46cc38cc1039848dc287162cc4cf2532
a065c2cf24295a13725af9c5dc8cc76c
87d0f33c047915a0000ca972f3b32adc
43da9d5db71bedf3afc6f10fc8297a00
3fcca411d6774571a81a9faa4026c69a
9f36002354b2b75a069facac88ce5651
064ec24407084bf597c7dc1edc3f9017
3f5cfb400d72c7b3663b617368a0b3af'
# 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