Languages
[Edit]
EN

JavaScript - String match() method example

0 points
Created by:
Hayley-Mooney
677

1. Documentation

Edit
SyntaxString match(regexp)
Parametersregexp - a regular expression object
Result

The method returns an array containing the results of that search, or null if no matches are found.

DescriptionThe match() method retrieves the result of matching a string against a regular expression.

2. More examples

Edit

In this example, we use the match() method to return an array of digits from the text string. 

Output:

See also

Edit
  1. JavaScript - exec() vs match()

References

Edit
  1. String.prototype.match() - JavaScript | MDN

Alternative titles

  1. JavaScript - String.prototype.match() documentation with examples
  2. js - String match() method documentation with examples
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript - String (documentation)

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join