JavaScript Regex Flags Quiz

Quiz 1 4 questions

Prerequisites for the quiz

  1. RegExp Flags chapter

Are you ready?

4 questions to solve

Instructions
  1. This quiz goes to full-screen once you press the Start button.
  2. At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
Which parts of the string "Rabbit lovers" does the expression /r/i match?
/r/i will look for the character 'r' case-insensitively and thus match the first 'R' character in the given string. This goes with choice A).
Which parts of the string "Mango Milkshake Moment" does the expression /M/g match?
/M/g will look for the character 'M' globally (and case-sensitively) and thus match all 'M''s in the given string. This goes with choice C).
What does the g flag do?
The global g flag makes an expression continue its search to find all occurences of a pattern in a given test string. For more info please refer to JavaScript RegExp Flags.
Which parts of the string "Hello, HELLO and hello!" does the expression /HELLO/i match?
With the i flag, the expression /HELLO/i will look for the first word 'HELLO' case-insensitively inside the given string; thus matching the first word - "Hello, HELLO and hello!". This goes with choice B). For more info please refer to JavaScript RegExp Flags.

"I created Codeguage to save you from falling into the same learning conundrums that I fell into."

— Bilal Adnan, Founder of Codeguage