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

البحث
الأقسام
إقرأ المزيد
Business
How Are User Stories Estimated?
In Agile development, user story estimation is one of the most essential, and sometimes most...
بواسطة Dacey Rankins 2025-08-25 18:48:23 0 6كيلو بايت
Programming
Python Comparison
Comparisons are used to compare two values in a code. For example, "==", "!=", ">", "<",...
بواسطة Jesse Thomas 2023-02-15 21:23:46 0 12كيلو بايت
Telecommunications
Telecommunications: Connecting the World
Telecommunications plays a vital role in our modern society, enabling communication across vast...
بواسطة Dacey Rankins 2024-10-15 18:28:20 0 18كيلو بايت
Mental Health
Psychosis: Disorganization of speech/thought or behavior
Disorganization is split into disorganized speech (or thought), and grossly disorganized motor...
بواسطة Kelsey Rodriguez 2023-05-16 18:26:01 0 12كيلو بايت
Marketing and Advertising
What Is User-Generated Content (UGC)?
Introduction In the modern digital ecosystem, every customer has a voice — and those...
بواسطة Dacey Rankins 2025-11-06 18:43:28 0 3كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov