Table of Contents
This method is a called against a regular expression and returns the matching values in the string. The return value is an array containing the matched values. If no matches are found within the string,
null is returned.
"hello world".match(/[el]/gi) // ["e", "l", "l", "l"]
const matchedStrings = string.match(regex)
This is the regular expression to search for within the string -
Returns an array
It returns an array of all matched characters in the string.
Extract specific information from a string
This method can be used to extract info from a string. Like getting an email address from a sentence.
Like this article? Follow @iChuloo on Twitter