JavaScript source Property
JavaScript RegExp Object
Definition and Usage
The source property is used to return the text used for pattern matching.
Syntax
RegExpObject.source
Browser support





All major browsers support the source property.
Example
Example
Return the text that matches the regular expression pattern:
var
str
=
"
Visit RUNOOB
"
;
var
patt1
=/
RUN
/
g
;
document
.
write
(
"
The text of the RegExp is:
"
patt1
.
source
)
;
Try it »
JavaScript RegExp Object