Ruby - Regular ExpressionsWhich of the following is the correct Ruby regex syntax to match any lowercase letter?A"\\a-z"B"[A-Z]"C"[a-z]"D"[0-9]"Check Answer
Step-by-Step SolutionSolution:Step 1: Understand character ranges in Ruby regexSquare brackets [] define a character class. "[a-z]" matches any lowercase letter from a to z.Step 2: Identify the correct lowercase letter range"[a-z]" uses "[a-z]" which is the correct syntax. "[A-Z]" matches uppercase letters, "\\a-z" is invalid, and "[0-9]" matches digits.Final Answer:"[a-z]" matches lowercase letters -> Option CQuick Check:Lowercase letters = "[a-z]" [OK]Quick Trick: Use [a-z] to match lowercase letters in regex [OK]Common Mistakes:Using uppercase range [A-Z] instead of lowercaseIncorrect escape like \a-zConfusing digits [0-9] with letters
Master "Regular Expressions" in Ruby9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Ruby Quizzes Advanced Metaprogramming - Module_eval for dynamic behavior - Quiz 5medium Concurrent Programming - Ractor for true parallelism - Quiz 3easy Functional Patterns in Ruby - Why functional patterns complement OOP - Quiz 9hard Functional Patterns in Ruby - Proc composition - Quiz 15hard Gems and Bundler - Why gem management matters - Quiz 13medium Metaprogramming Fundamentals - Open struct for dynamic objects - Quiz 15hard Regular Expressions - Match operator (=~) - Quiz 1easy Ruby Ecosystem and Best Practices - Ruby version management (rbenv, rvm) - Quiz 4medium Testing with RSpec and Minitest - RSpec describe and it blocks - Quiz 5medium Testing with RSpec and Minitest - Minitest basics (assert style) - Quiz 11easy