A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-regexp-quantifier-2/ below:

JavaScript RegExp + Quantifier - GeeksforGeeks

JavaScript RegExp + Quantifier

Last Updated : 11 Jul, 2025

The m+ Quantifier in JavaScript is used to find the match of any string that contains at least one m

JavaScript
let str = "GeeksforGeeks@_123_$";
let regex = /G+/gi;
let match = str.match(regex);

console.log("Found " + match.length + " matches: " + match);
Syntax: 
/m+/ 

Example 1: Matches the presence of the word 'e' in the whole string. 

JavaScript
let str = "GeeksforGeeks@_123_$";
let regex = /e+/gi;
let match = str.match(regex);

console.log("Found " + match.length + " matches: " + match);

Output
Found 2 matches: ee,ee

 Example 2: Replaces the word 'ee' with 'EE'. 

JavaScript
let str = "GeeKY@128";
let regex = new RegExp("e+", "gi");
let replace = "EE";
let match = str.replace(regex, replace);
console.log(" New string: " + match);

Output
 New string: GEEKY@128
Recommended Links:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4