String.prototype.match()

0
6KB

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

Search
Nach Verein filtern
Read More
Online
Top 5 popular games of 2023
2023 is looking to be a great year for games. Therefore, we have created a list of the most...
Von FWhoop Xelqua 2023-05-05 15:24:26 0 16KB
Жизненные вопросы
Остров проклятых. Shutter Island. (2010)
Два американских судебных пристава отправляются на один из островов в штате Массачусетс, чтобы...
Von Nikolai Pokryshkin 2023-02-15 18:36:29 0 16KB
Социальные проблемы
Жизнь прекрасна. Life Is Beautiful. (1997)
Во время Второй мировой войны из Италии в концлагерь были отправлены евреи - отец с маленьким...
Von Nikolai Pokryshkin 2022-11-19 16:37:39 0 21KB
Television
SMNI News (English) Live TV Philippines
Sonshine Media Network International (SMNI), is the official broadcasting arm of the Kingdom of...
Von Nikolai Pokryshkin 2022-08-30 21:56:36 0 24KB
Business
Infrastructure as a Service (IaaS): Virtual Infrastructure Delivery
Infrastructure as a Service (IaaS) is a cloud service model that allows you to rent virtual...
Von Dacey Rankins 2024-09-25 17:33:58 0 18KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov