Ruby - Regular Expressions
How can you use the
match method to check if a string contains only digits and extract them?match method to check if a string contains only digits and extract them?/^\d+$/ ensures the whole string contains only digits.m is not nil, m[0] contains the digits.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions