Regular Expressions provide a powerful way to extract information from text content. Regular Expressions or Regex can be used to search text and find matches on the search pattern. The returned results are the matches from the text on the search pattern provided. The search pattern can get fairly complex, this chapter is designed to provide a simple introduction to extracting results from text blocks.
Regular expression literal
const myPattern1 = /a/;
RegExp constructor object
const myPattern2 = new RegExp(‘a’);