English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript RegExp source Property

 JavaScript RegExp RegExp Object

sourceThe property returns a string that contains the source text of the regexp object, without the two forward slashes at both ends and any modifiers.

Syntax:

regex.source
var str = "Hello world";
var regex = /Hello/g;
regex.source;
Test See‹/›

Browser Compatibility

All browsers fully support the source property:

Properties
sourceYesYesYesYesYes

Technical Details

Writable:No
Enumerable:No
Configurable:Yes
Return Value:Text of RegExp Pattern
JavaScript Version:ECMAScript 1

 JavaScript RegExp RegExp Object