String.prototype.match()

0
11χλμ.

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

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Life Issues
Intimacy. (2001)
A failed London musician meets once a week with a woman for a series of intense sexual encounters...
από Leonard Pokrovski 2023-05-23 16:49:21 0 33χλμ.
Money
What is Negative Equity?
What is Negative Equity? Negative equity is a financial situation where the value of an asset,...
από Leonard Pokrovski 2025-09-27 17:35:48 0 4χλμ.
Business
Why do we need psychology in a commercial offer
Why do we need psychology in a commercial offer? Psychology in a commercial offer helps to...
από Leonard Pokrovski 2024-08-22 16:15:11 0 18χλμ.
Money
What does investing mean?
What does investing mean? When people hear the word investing, they often think of stock...
από Leonard Pokrovski 2025-09-30 20:59:52 0 3χλμ.
Business
How Can Late-Stage Startups Maintain Innovation?
As startups transition into late-stage companies, maintaining innovation becomes a challenge....
από Dacey Rankins 2025-03-07 13:42:46 0 12χλμ.

BigMoney.VIP Powered by Hosting Pokrov