`

Regular Expressions - Draft

Regex helps in finding/search and/or manipulate after find/search operation using specified patterns and works on texts (especially fields). In simple terms, it’s a sequence of characters used for defining a search pattern.
The pattern is always read from left to right sequentially.

Define the regexp

  1. let regex = new RegExp(“pattern”, “flags”);
  2. let regex = /pattern/flags;

Execute the regexp

  1. regex.test: Always returns true or false

It utilizes meta characters to define the search patterns. Below is the list of the meta characters:

  1. Square bracket: “[]”
  2. Dot: “.” , Colon: “:”
  3. Caret: ^ , Dollar: “$”
  4. Star: “*”, Plus: “+”, Question Mark: “?”
  5. Curly Braces: “{}”
  6. Round Brackets: “()”
  7. OR: “|”
  8. Backslash: “"

Examples