JavaScript RegExp + Quantifier
Example 1
Do a global search for at least one "o":
let text = "Hellooo World! Hello W3Schools!";
let pattern = /o+/g;
Try it Yourself »
Description
The n+ quantifier matches any string that contains at least one n.
Example 2
Do a global search for at least one word character:
let text = "Hellooo World! Hello W3Schools!";
let pattern = /\w+/g;
Try it Yourself »
Browser Support
/n+/
is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
new RegExp("n+")
or simply:
/n+/
Syntax with modifiers
new RegExp("n+", "g")
or simply:
/n+/g