Vidyalelo
Ruby Programming · all questions

Regular Expressions in Ruby
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

26

Questions

1/2

Page

Pick an option on a question to see the right answer and solution.

What does the =~ operator do in Ruby when used with regular expressions?

Select an option to see the answer and solution.

Which method is used to find the first occurrence of a pattern in a string in Ruby?

Select an option to see the answer and solution.

What does the /\A anchor represent in a regular expression in Ruby?

Select an option to see the answer and solution.

What is the purpose of the + quantifier in a regular expression in Ruby?

Select an option to see the answer and solution.

Which modifier is used to perform case-insensitive matching in Ruby regular expressions?

Select an option to see the answer and solution.

What does the \d character class represent in a regular expression in Ruby?

Select an option to see the answer and solution.

Which metacharacter is used to specify optional characters in a regular expression in Ruby?

Select an option to see the answer and solution.

What does the ^ anchor represent in a regular expression in Ruby?

Select an option to see the answer and solution.

Which method is used to replace occurrences of a pattern in a string with a specified string in Ruby?

Select an option to see the answer and solution.

What does the \s character class represent in a regular expression in Ruby?

Select an option to see the answer and solution.

Which modifier is used to perform multiline matching in Ruby regular expressions?

Select an option to see the answer and solution.

What does the \b anchor represent in a regular expression in Ruby?

Select an option to see the answer and solution.

What is the purpose of the * quantifier in a regular expression in Ruby?

Select an option to see the answer and solution.

What does the \w character class represent in a regular expression in Ruby?

Select an option to see the answer and solution.

Which method is used to extract all occurrences of a pattern in a string in Ruby?

Select an option to see the answer and solution.

What does the $ anchor represent in a regular expression in Ruby?

Select an option to see the answer and solution.

Which metacharacter is used to specify character ranges in a regular expression in Ruby?

Select an option to see the answer and solution.

Which modifier is used to perform global matching in Ruby regular expressions?

Select an option to see the answer and solution.

What does the \A anchor represent in a regular expression in Ruby?

Select an option to see the answer and solution.

What is the purpose of the \G anchor in a regular expression in Ruby?

Select an option to see the answer and solution.