GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — JavaScript String match() Method - GeeksforGeeks JavaScript String match() MethodLast Updated : 11 Jun, 2026 The match() method in JavaScript is used for identifying and retrieving substrings that fit a specified pattern, defined by a regular expression. It is often used when you need to find particular patterns within strings, enabling efficient text processing. This method returns an array of matched substrings or null if no match is found. Syntax:string.match(regExp);Parameters:
Return Value:
Example 1: Using the /g Flag (Global)The global (g) flag ensures that all occurrences of the matching pattern are returned. Below is an example that matches the substring "eek" multiple times in the string:
Example 2: Using the /i Flag (Case-Insensitive)The case-insensitive (i) flag allows the match() method to ignore letter case when matching patterns. Here is an example:
Example 3: Using the /gi Flag (Global and Case-Insensitive)When both the global (g) and case-insensitive (i) flags are used together, the match() method will find all case-insensitive matches throughout the string. Below is an example:
Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |