Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
Note: All RegExp static properties that expose the last match state globally are deprecated. See deprecated RegExp features for more information.
Because $1–$9 are static properties of RegExp, you always use them as RegExp.$1, RegExp.$2, etc., rather than as properties of a RegExp object you created.
The following script uses the RegExp.prototype.test() method to grab a number in a generic string.
This page was last modified on Aug 21, 2026 by MDN contributors.