String.prototype.match()

0
4KB

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
Other
Why Americans Feel So Poor? (2023)
this documentary will be showing everything about Inflation, low salary rates, Inflation, bad...
Von Leonard Pokrovski 2023-06-01 19:44:44 0 17KB
Financial Services
The benefits and costs of US environmental laws
Key points Taken as a whole, the benefits of US environmental regulation have...
Von Mark Lorenzo 2023-02-20 17:47:53 0 5KB
Dentistry
The Importance of Dentistry: Keeping Smiles Healthy
Dentistry plays a crucial role in maintaining overall health and well-being. While often...
Von Dacey Rankins 2024-10-10 15:29:40 0 15KB
Television
National Religious Broadcasters. Live TV. USA.
National Religious Broadcasters (NRB) is an international association of evangelical...
Von Nikolai Pokryshkin 2022-10-09 11:41:51 0 16KB
Personal Organization
Child Protective Services
Government agencies in many U.S. states responsible for child protectionChild Protective Services...
Von FWhoop Xelqua 2023-01-09 16:33:49 0 25KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov