String.prototype.match()

0
12χλμ.

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]().

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Business
Frequency of One-on-One Meetings: Do I Have to Run Weekly 1:1s?
How Often Is Often Enough? One-on-one meetings (1:1s) are among the most important tools for...
από Dacey Rankins 2025-08-01 14:09:35 0 11χλμ.
Business
A User Story is Just a Placeholder for a Conversation
In Agile development, user stories are often misunderstood. Many people treat them as...
από Dacey Rankins 2025-08-26 12:26:36 0 14χλμ.
Business
How Do I Build a Strong Startup Team?
A great idea can spark a startup, but a great team makes it thrive. In the fast-paced world of...
από Dacey Rankins 2025-04-11 16:57:21 0 14χλμ.
Business
What’s the Difference Between User Retention and Churn?
When businesses measure customer health, two metrics consistently come up: retention and churn....
από Dacey Rankins 2025-09-16 16:33:48 0 5χλμ.
Food and Related Products
Chocolate and its history
The history of chocolate began in Mesoamerica. Fermented beverages made from chocolate date back...
από FWhoop Xelqua 2023-05-20 19:46:42 0 32χλμ.

BigMoney.VIP Powered by Hosting Pokrov