Created
September 14, 2018 10:44
-
-
Save dasgoll/0e2addaa8bd35e7581be9700000f7c80 to your computer and use it in GitHub Desktop.
Ruby regex example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
re = /[(]\d{2}[)]/m | |
str = '19 | |
20 | |
(24) | |
' | |
# Print the match result | |
str.scan(re) do |match| | |
puts match.to_s | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment