Regular Expressions In Ruby - Study Mode

[#1] What does the =~ operator do in Ruby when used with regular expressions?
Correct Answer

(C) Matches a string against a regular expression

[#2] Which method is used to find the first occurrence of a pattern in a string in Ruby?
Correct Answer

(D) String#match

[#3] What does the /A anchor represent in a regular expression in Ruby?
Correct Answer

(C) Matches the start of a string

[#4] What is the purpose of the + quantifier in a regular expression in Ruby?
Correct Answer

(D) Matches one or more occurrences of the preceding character

[#5] Which modifier is used to perform case-insensitive matching in Ruby regular expressions?
Correct Answer

(A) i