String.prototype.match()

0
9K

A regular expression object, or any object that has a Symbol.match method.

If regexp is not a RegExp object and does not have a Symbol.match method, it is implicitly converted to a RegExp by using new RegExp(regexp).

If you don't give any parameter and use the match() method directly, you will get an Array with an empty string: [""], because this is equivalent to match(/(?:)/).

Return value

An Array whose contents depend on the presence or absence of the global (g) flag, or null if no matches are found.

  • If the g flag is used, all results matching the complete regular expression will be returned, but capturing groups are not included.
  • If the g flag is not used, only the first complete match and its related capturing groups are returned. In this case, match() will return the same result as RegExp.prototype.exec() (an array with some extra properties).

Description

The implementation of String.prototype.match itself is very simple — it simply calls the Symbol.match method of the argument with the string as the first parameter. The actual implementation comes from RegExp.prototype[@@match]().

For more information about the semantics of match() when a regex is passed, see RegExp.prototype[@@match]().

Site içinde arama yapın
Kategoriler
Read More
Play-By-Mail
The World of Play-by-Mail Games: A Nostalgic and Strategic Gaming Experience
In today’s digital age, video games and online multiplayer experiences dominate the gaming...
By Dacey Rankins 2024-11-22 14:37:53 0 11K
Business
Youtube Video Promotion: 7 Proven Ways
In the era of digital technology and social media, promoting video content is becoming one of the...
By Dacey Rankins 2024-09-19 16:49:03 0 13K
Bodyart
Body Art
Body art is a form of avant-garde art that developed in the 1960s. The main object of body art is...
By FWhoop Xelqua 2023-06-26 17:01:47 0 21K
Business
How Do You Manage Risk in Innovation?
Innovation is the engine of growth for modern businesses. Whether it’s launching a new...
By Dacey Rankins 2025-08-19 17:58:24 0 888
Softball
Softball: A Celebration of Skill, Strategy, and Team Spirit
Softball: A Celebration of Skill, Strategy, and Team Spirit Softball, a dynamic sport born from...
By Leonard Pokrovski 2024-07-10 09:15:48 0 20K

BigMoney.VIP Powered by Hosting Pokrov