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

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Human Resources
What Industries Use Headhunting the Most?
Modern organizations operate in increasingly competitive labor markets where attracting and...
από Dacey Rankins 2026-03-16 14:57:50 0 2χλμ.
Programming
Python Fun Fact
There's a fact about Python that you might not know! Python has a module called "this". The...
από Jesse Thomas 2023-02-03 19:15:26 0 14χλμ.
Marketing and Advertising
How Much Should I Budget for Mobile Marketing / What Is the ROI?
Introduction In today’s hyperconnected economy, mobile marketing is not just an optional...
από Dacey Rankins 2025-10-17 15:28:45 0 10χλμ.
Programming
Python Datetime
Datetime in Python is the combination between dates and times. The attributes of this class are...
από Jesse Thomas 2023-03-22 21:22:54 0 12χλμ.
Productivity
What are techniques to focus in a noisy environment?
What Are Techniques to Focus in a Noisy Environment? Focusing in a noisy environment is a...
από Michael Pokrovski 2026-04-18 06:57:22 0 1χλμ.

BigMoney.VIP Powered by Hosting Pokrov