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
Top 15 Questions to Ask About Company Culture
Understanding a company’s culture is crucial when considering a new job, forming a...
από Dacey Rankins 2025-06-12 14:52:47 0 13χλμ.
Business
Competitive Intelligence
Competitive Intelligence (abbr. CI) is the collection and processing of data from various sources...
από Dacey Rankins 2024-07-18 13:11:42 0 13χλμ.
Internet
Google Ads, part 9: How to Create an Advertisment
part 8: Google Ads : Mectrics (bigmoney.vip) Two basic elements of ads to start with... Heading...
από FWhoop Xelqua 2023-02-15 11:53:19 0 19χλμ.
Television
The Evolution of Television: A Cultural Revolution in Pictures and Sound
Television has become one of the most influential inventions in modern history, shaping not only...
από Dacey Rankins 2024-11-05 15:40:04 0 11χλμ.
Marketing and Advertising
Do I Need to Hire a PR Firm or Can I DIY? A Complete Guide for Modern Businesses
Introduction: The PR Dilemma for Businesses Every business, whether a startup or a global...
από Dacey Rankins 2025-10-27 17:15:35 0 4χλμ.

BigMoney.VIP Powered by Hosting Pokrov