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

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Personal Finance
Should I choose federal or private student loans?
Should I choose federal or private student loans? Short answer: Start with federal loans. For...
από Leonard Pokrovski 2025-12-16 21:10:40 0 10χλμ.
Marketing and Advertising
Is Radio Advertising Effective?
Reach, Impact, ROI, and Real-World Performance in Modern Marketing Radio has been a cornerstone...
από Dacey Rankins 2026-02-06 19:25:53 0 4χλμ.
История
Плохой поэт. Il cattivo poeta / The Bad Poet. (2021)
1936 год. Джованни Комини - самый молодой федеральный секретарь национал-фашистсткой партии...
από Nikolai Pokryshkin 2022-09-11 21:01:31 0 32χλμ.
Marketing and Advertising
How Do I Create Retargeting Audiences? A Complete Guide to Website Visitors, Cart Abandoners, and Video Viewers
Retargeting only works when advertisers know exactly who they are targeting. Without well-built...
από Dacey Rankins 2026-02-16 14:30:52 0 8χλμ.
Телевидение
PUBLIKA Live TV. Телевидение на русском, молдавском и румынском.
Телевидение Молдавии на русском и молдавском языках. Новости, погода, политика, происшествия и...
από Nikolai Pokryshkin 2022-10-31 14:28:01 0 35χλμ.

BigMoney.VIP Powered by Hosting Pokrov