Question · JavaScript and TypeScript course · Module 5: Advanced JavaScript

Advanced Regular Expressions - Creation

What are the two ways to create regular expressions in JavaScript?

Answer options

  • JSON.parse() and JSON.stringify()
  • Literal /pattern/ and constructor new RegExp('pattern')
  • document.regex() and window.match()
  • String.regex() and Array.match()

You can check the correct answer by solving this task in the CodeWorlds game.