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

البحث
الأقسام
إقرأ المزيد
Finance
Are There Finance Biographies Focused on Female Financiers and Underrepresented Groups?
Are There Finance Biographies Focused on Female Financiers and Underrepresented Groups? In the...
بواسطة Leonard Pokrovski 2025-10-08 20:41:01 0 6كيلو بايت
Business
Do Accelerators Provide Funding?
most accelerators provide funding, typically in the form of seed investment in exchange for...
بواسطة Dacey Rankins 2025-04-23 16:17:44 0 15كيلو بايت
Marketing and Advertising
What Types or Formats of Content Are Most Likely to Go Viral?
Introduction Every brand dreams of creating that one piece of content that everyone talks about...
بواسطة Dacey Rankins 2025-11-10 17:36:12 0 3كيلو بايت
Science Fiction and Fantasy
Groundhog Day (1993)
A narcissistic, self-centered weatherman finds himself in a time loop on Groundhog Day, and the...
بواسطة Leonard Pokrovski 2023-06-24 20:18:36 0 39كيلو بايت
Business
You Can’t Hack the Growth of Just Anything: Why Growth Hacking Requires Product/Market Fit First
One of the most common misconceptions about growth hacking is that it can be applied to any...
بواسطة Dacey Rankins 2025-09-12 20:03:33 0 3كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov