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
What Are Commission-Based Models?
A founder once showed me a marketplace that had everything going for it. Customers were signing...
بواسطة Dacey Rankins 2026-06-30 05:32:50 0 2كيلو بايت
Business
How Can Retailers Improve Profitability?
A retailer can have crowded stores, impressive website traffic, enthusiastic customers, and...
بواسطة Dacey Rankins 2026-07-21 18:46:12 0 4كيلو بايت
Алгоритмы
Как работают алгоритмы Tik Tok
Продвижение бизнеса в Tik Tok это уже необходимость.Tik Tok - это социальная сеть. Многие не...
بواسطة Dmitry Novikov 2023-01-30 00:50:30 0 38كيلو بايت
Business
Meetings are a total waste of time. Here's how to make them useful
If you've ever sat through a meeting and left wondering, "What was the point of that?", you're...
بواسطة Dacey Rankins 2025-06-03 13:21:34 0 11كيلو بايت
Business
Should Meetings Be Standing or Walking? Exploring Alternative Formats for Engagement and Efficiency
Traditional seated meetings have long been the norm in workplaces, but the rise of standing and...
بواسطة Dacey Rankins 2025-08-04 18:23:16 0 9كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov