Regular Expressions in JavaScript

How to create regex in JavaScript?

  1. Literal notation
  2. Constructor function

RegExp methods and properties

  1. exec()
  2. test()
  3. lastIndex

String methods that support regex

  1. match()
  2. matchAll()
  3. replace()
  4. replaceAll()
  5. search()
  6. split()