id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
Mmdn_RegExp/javascriptregexpexer_14_0.txt
**Live Demo:**
Mmdn_RegExp/Regularexpressions_213_0.txt
## Support
Mmdn_RegExp/toString_45_0.txt
A customized MDN experience
Mmdn_RegExp/Mmdn_RegExp_20_4.txt
Deprecated ]: Deprecated. Not for use in new websites. *[ Deprecated ]: Deprecated. Not for use in new websites. *[ Non-standard ...
Mmdn_RegExp/Regularexpressions_166_0.txt
[ ` RegExp.prototype.exec() ` ](/en- US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) method with the ` g ` flag returns each match and its position iteratively.
Mmdn_RegExp/Regularexpressions_129_0.txt
## Using regular expressions in JavaScript
Mmdn_RegExp/Mmdn_RegExp_15_3.txt
milarly, a regex is _Unicode-unaware_ if it has neither the ` u ` nor the ` v ` flag. In this case, the regex is interpreted as a sequence of UTF-16 code units, and there are many legacy syntaxes that do not become syntax errors. ## Examples ### Using the unicode property js const regex = /\u{61}/u;...
Mmdn_RegExp/Mmdn_RegExp_21_0.txt
* Skip to main content * Skip to search * Skip to select language [ MDN Web Docs ](/en-US/) Open main menu * References [ References ](/en-US/docs/Web) * [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web) * [ HTML Structure of content on the web ](/en-US/do...
Mmdn_RegExp/Mmdn_RegExp_5_5.txt
k cross-browser support before using.
Mmdn_RegExp/exec_71_0.txt
4. [ ` Function.prototype.call() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) 5. [ ` Function.prototype.toString() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString) 10. Static properties 1. [ ` Function.prototype.arguments ` ](/en-US/docs/Web/JavaScript/Reference/Globa...
Mmdn_RegExp/javascriptregexpexer_27_0.txt
* * *
Mmdn_RegExp/exec_83_0.txt
If the match fails, the ` exec() ` method returns [ ` null ` ](/en- US/docs/Web/JavaScript/Reference/Operators/null) , and sets the regex's [ ` lastIndex ` ](/en- US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) to ` 0 ` .
Mmdn_RegExp/Regularexpressions_135_0.txt
If you do not need to access the properties of the regular expression, an alternative way of creating ` myArray ` is with this script:
Mmdn_RegExp/Mmdn_RegExp_11_1.txt
` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastParen) Deprecated 11....
Mmdn_RegExp/Regularexpressions_17_0.txt
* [ Web APIs
Mmdn_RegExp/exec_65_0.txt
* English (US)
Mmdn_RegExp/Mmdn_RegExp_29_3.txt
string) ## Browser compatibility BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data. ## See also * [ ` Object.prototype.toString() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString) ## Help improve MDN Was this page helpful to you? Yes No ...
Mmdn_RegExp/Regularexpressions_41_0.txt
* [ Accessibility
Mmdn_RegExp/Mmdn_RegExp_23_3.txt
console.log(regex.ignoreCase); // true ## Specifications Specification --- [ ECMAScript Language Specification # sec-get-regexp.prototype.ignorecase ](https://tc39.es/ecma262/multipage/text-processing.html#sec-get- regexp.prototype.ignorecase) ## Browser compatibility BCD tables only load in the b...
Mmdn_RegExp/Mmdn_RegExp_8_1.txt
tIndex ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastParen) Deprecated ...
Mmdn_RegExp/Regularexpressions_55_0.txt
](/en-US/plus/docs/features/overview)
Mmdn_RegExp/Regularexpressions_98_0.txt
When the search for a match requires something more than a direct match, such as finding one or more b's, or finding white space, you can include special characters in the pattern. For example, to match _a single` "a" ` followed by zero or more ` "b" ` s followed by ` "c" ` _ , you'd use the pattern ` /ab*c/ ` : the ` ...
Mmdn_RegExp/toString_19_0.txt
](/en-US/docs/Web/API)
Mmdn_RegExp/exec_95_0.txt
JavaScript [ ` RegExp ` ](/en- US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) objects are _stateful_ when they have the [ global ](/en- US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global) or [ sticky ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) flags set (e.g. ` /foo/g ` or `...
Mmdn_RegExp/Regularexpressions_170_0.txt
console.log(str.match(re)); // ["fee ", "fi ", "fo "]
Mmdn_RegExp/exec_133_0.txt
* [ MDN on Mastodon ](https://mozilla.social/@mdn) * [ MDN on X (formerly Twitter) ](https://twitter.com/mozdevnet) * [ MDN on GitHub ](https://github.com/mdn/) * [ MDN Blog RSS Feed ](/en-US/blog/rss.xml)
Mmdn_RegExp/Regularexpressions_117_0.txt
**Note:** [ A larger cheat sheet is also available ](/en- US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet) (only aggregating parts of those individual articles).
Mmdn_RegExp/Mmdn_RegExp_18_8.txt
Portions of this content are ©1998– 2024 by individual mozilla.org contributors. Content available under [ a Creative Commons license ](/en- US/docs/MDN/Writing_guidelines/Attrib_copyright_license) . *[ Deprecated ]: Deprecated. Not for use in n...
Mmdn_RegExp/Regularexpressions_214_0.txt
* [ Product help ](https://support.mozilla.org/products/mdn-plus) * [ Report an issue ](/en-US/docs/MDN/Community/Issues)
Mmdn_RegExp/Regularexpressions_156_0.txt
For example, ` re = /\w+\s/g ` creates a regular expression that looks for one or more characters followed by a space, and it looks for this combination throughout the string.
Mmdn_RegExp/exec_61_0.txt
Theme
Mmdn_RegExp/Regularexpressions_67_0.txt
Filter sidebar Clear filter input
Mmdn_RegExp/toString_81_0.txt
### Return value
Mmdn_RegExp/Mmdn_RegExp_17_0.txt
* Skip to main content * Skip to search * Skip to select language [ MDN Web Docs ](/en-US/) Open main menu * References [ References ](/en-US/docs/Web) * [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web) * [ HTML Structure of content on the web ](/en-US/do...
Mmdn_RegExp/Regularexpressions_59_0.txt
* [ Curriculum New ](/en-US/curriculum/) * [ Blog ](/en-US/blog/) * [ Play ](/en-US/play) * [ AI Help Beta ](/en-US/plus/ai-help)
Mmdn_RegExp/Regularexpressions_165_0.txt
#### Using the global search flag with exec()
Mmdn_RegExp/exec_18_0.txt
Interfaces for building web applications
Mmdn_RegExp/Mmdn_RegExp_4_3.txt
cts/RegExp/ignoreCase) * [ ` RegExp.prototype.multiline ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) * [ ` RegExp.prototype.source ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source) * [ ` RegExp.prototype.sticky ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objec...
Mmdn_RegExp/Mmdn_RegExp_21_2.txt
Script/Reference/Global_Objects/Object/constructor) 2. [ ` Object.prototype.__proto__ ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) Deprecated 13. Methods 1. [ ` Object.prototype.__defineGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) Depre...
Mmdn_RegExp/Mmdn_RegExp_5_3.txt
once. For each ` exec() ` result, the substitution will be prepared based on the description in [ ` String.prototype.replace() ` ](/en- US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#description) . Because ` @@replace ` would keep calling ` exec() ` until it returns ` null ` , and ` exec() ` would aut...
Mmdn_RegExp/exec_12_0.txt
General-purpose scripting language
Mmdn_RegExp/javascriptregexpexer_26_0.txt
Load Disqus Comments
Mmdn_RegExp/Regularexpressions_182_0.txt
#### HTML
Mmdn_RegExp/Mmdn_RegExp_0_11.txt
JavaScript/Reference/Global_Objects/GeneratorFunction) * [ ` AsyncGeneratorFunction ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGeneratorFunction) * [ ` Generator ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator) * [ ` AsyncGenerator ` ](/en-US/docs/Web/JavaScript/Reference/Globa...
Mmdn_RegExp/Mmdn_RegExp_18_2.txt
rototype.__proto__ ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) Deprecated 13. Methods 1. [ ` Object.prototype.__defineGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) Deprecated 2. [ ` Object.prototype.__defineSetter__() ` ](/en-US/docs/W...
Mmdn_RegExp/Regularexpressions_101_0.txt
Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions).
Mmdn_RegExp/Mmdn_RegExp_26_4.txt
%2FJavaScript%2FReference%2FGlobal_Objects%2FRegExp%2F%40%40split&metadata=%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EPage+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en- us%2Fweb%2Fjavascript%2Freference%2Fglobal_objects%2Fregexp%2F%40%40split%60%0A*+MDN+URL%3A+https%3A%2F...
Mmdn_RegExp/Mmdn_RegExp_13_3.txt
en- US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/compile/contributors.txt) . [ View this page on GitHub ](https://github.com/mdn/content/blob/main/files/en- us/web/javascript/reference/global_objects/regexp/compile/index.md?plain=1 "Folder: en-us/web/javascript/reference/global_objects/regexp/compile \(Opens...
Mmdn_RegExp/exec_24_0.txt
Web technology reference for developers
Mmdn_RegExp/Regularexpressions_35_0.txt
* [ CSS
Mmdn_RegExp/Regularexpressions_225_0.txt
]: Non-standard. Check cross-browser support before using.
Mmdn_RegExp/Regularexpressions_36_0.txt
Learn to style content using CSS
Mmdn_RegExp/Mmdn_RegExp_0_12.txt
iscourse.mozilla.org/c/mdn/236) * [ MDN Chat ](/discord) ## Developers * [ Web Technologies ](/en-US/docs/Web) * [ Learn Web Development ](/en-US/docs/Learn) * [ MDN Plus ](/en-US/plus) * [ Hacks Blog ](https://hacks.mozilla.org/) [ Mozilla logo ](https://www.mozilla.org/) * [ Website Privacy Notice ]...
Mmdn_RegExp/toString_27_0.txt
Learn web development
Mmdn_RegExp/Mmdn_RegExp_28_2.txt
al_Objects/Object/constructor) 2. [ ` Object.prototype.__proto__ ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) Deprecated 13. Methods 1. [ ` Object.prototype.__defineGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) Deprecated 2. [ ` Obj...
Mmdn_RegExp/exec_32_0.txt
* [ HTML
Mmdn_RegExp/toString_97_0.txt
## Browser compatibility
Mmdn_RegExp/Mmdn_RegExp_15_0.txt
* Skip to main content * Skip to search * Skip to select language [ MDN Web Docs ](/en-US/) Open main menu * References [ References ](/en-US/docs/Web) * [ Overview / Web Technology Web technology reference for developers ](/en-US/docs/Web) * [ HTML Structure of content on the web ](/en-US/do...
Mmdn_RegExp/Mmdn_RegExp_17_1.txt
p: lastIndex ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastParen) Deprec...
Mmdn_RegExp/Mmdn_RegExp_15_2.txt
_Objects/Object/constructor) 2. [ ` Object.prototype.__proto__ ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) Deprecated 13. Methods 1. [ ` Object.prototype.__defineGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) Deprecated 2. [ ` Objec...
Mmdn_RegExp/toString_12_0.txt
General-purpose scripting language
Mmdn_RegExp/Regularexpressions_102_0.txt
[ Character classes ](/en- US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes) guide
Mmdn_RegExp/javascriptregexpexer_20_0.txt
Test your Programming skills with w3resource's [ quiz. ](https://www.w3resource.com/quizzes/index.php)
Mmdn_RegExp/Mmdn_RegExp_14_1.txt
d 8. [ ` RegExp: lastIndex ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegEx...
Mmdn_RegExp/Mmdn_RegExp_10_1.txt
dex ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastParen) Deprecated ...
Mmdn_RegExp/Regularexpressions_202_0.txt
## Help improve MDN
Mmdn_RegExp/Regularexpressions_209_0.txt
Your blueprint for a better internet.
Mmdn_RegExp/Regularexpressions_103_0.txt
Distinguish different types of characters. For example, distinguishing between letters and digits.
Mmdn_RegExp/javascriptregexpexer_1_0.txt
# JavaScript: Check whether the first character of a string is uppercase or not
Mmdn_RegExp/exec_53_0.txt
* [ Documentation
Mmdn_RegExp/exec_36_0.txt
Learn to style content using CSS
Mmdn_RegExp/Regularexpressions_3_0.txt
Web technology reference for developers
Mmdn_RegExp/toString_112_0.txt
## Support
Mmdn_RegExp/exec_58_0.txt
](/en-US/plus/docs/faq)
Mmdn_RegExp/Regularexpressions_196_0.txt
An online regex builder/debugger
Mmdn_RegExp/toString_116_0.txt
## Developers
Mmdn_RegExp/toString_72_0.txt
## In this article
Mmdn_RegExp/exec_128_0.txt
[ Learn how to contribute ](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you to our contribution guidelines on GitHub.") .
Mmdn_RegExp/Mmdn_RegExp_26_1.txt
8. [ ` RegExp: lastIndex ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/la...
Mmdn_RegExp/exec_82_0.txt
### Return value
Mmdn_RegExp/exec_88_0.txt
The original string that was matched against.
Mmdn_RegExp/Regularexpressions_106_0.txt
[ Quantifiers ](/en- US/docs/Web/JavaScript/Guide/Regular_expressions/Quantifiers) guide
Mmdn_RegExp/Mmdn_RegExp_18_1.txt
/Global_Objects/RegExp/lastIndex) 9. [ ` RegExp.lastMatch ($&) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch) Deprecated 10. [ ` RegExp.lastParen ($+) ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastParen) Deprecated 11. [ ` RegExp.leftContext ($`) ` ](/en-US/...
Mmdn_RegExp/javascriptregexpexer_4_0.txt
Write a JavaScript program to test whether the first character of a string is uppercase or not.
Mmdn_RegExp/Regularexpressions_42_0.txt
Learn to make the web accessible to all
Mmdn_RegExp/exec_94_0.txt
## Description
Mmdn_RegExp/exec_10_0.txt
](/en-US/docs/Web/CSS)
Mmdn_RegExp/Regularexpressions_112_0.txt
[ Assertions ](/en- US/docs/Web/JavaScript/Guide/Regular_expressions/Assertions)
Mmdn_RegExp/exec_135_0.txt
* [ About ](/en-US/about) * [ Blog ](/en-US/blog/) * [ Careers ](https://www.mozilla.org/en-US/careers/listings/?team=ProdOps) * [ Advertise with us ](/en-US/advertising)
Mmdn_RegExp/Regularexpressions_66_0.txt
* [ Español ](/es/docs/Web/JavaScript/Guide/Regular_expressions) * [ Français ](/fr/docs/Web/JavaScript/Guide/Regular_expressions) * [ 日本語 ](/ja/docs/Web/JavaScript/Guide/Regular_expressions) * [ 한국어 ](/ko/docs/Web/JavaScript/Guide/Regular_expressions) * [ Português (do Brasil) ](/pt-BR/docs/Web/Ja...
Mmdn_RegExp/exec_55_0.txt
](/en-US/plus/docs/features/overview)
Mmdn_RegExp/Regularexpressions_180_0.txt
The regular expression looks for:
Mmdn_RegExp/toString_8_0.txt
* [ CSS
Mmdn_RegExp/toString_118_0.txt
[ Mozilla logo ](https://www.mozilla.org/)
Mmdn_RegExp/Mmdn_RegExp_21_3.txt
would not be reset. In this case, each call to ` match() ` may return a different result. js const re = /[abc]/y; for (let i = 0; i < 5; i++) { console.log("abc".match(re), re.lastIndex); } // [ 'a' ] 1 // [ 'b' ] 2 // [ 'c' ] 3 // null 0 // [ 'a' ] 1 When the reg...
Mmdn_RegExp/Regularexpressions_96_0.txt
Simple patterns are constructed of characters for which you want to find a direct match. For example, the pattern ` /abc/ ` matches character combinations in strings only when the exact sequence ` "abc" ` occurs (all characters together and in that order). Such a match would succeed in the strings ` "Hi, do you know yo...
Mmdn_RegExp/Mmdn_RegExp_18_4.txt
tch() ` would construct a new ` RegExp ` object with the two enclosing slashes added by [ ` re.toString() ` ](/en- US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/toString) ), but it can be used for virtually everything else. js const re = /bar/g; re[Symbol.match] = false; "/bar/g".endsWi...
Mmdn_RegExp/Regularexpressions_52_0.txt
](/en-US/plus/updates)
Mmdn_RegExp/exec_79_0.txt
### Parameters
Mmdn_RegExp/Regularexpressions_31_0.txt
](/en-US/docs/Learn)