Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript source Property

JavaScript source Property

RegExp Object Reference JavaScript RegExp Object


Definition and Usage

The source property is used to return the text used for pattern matching.

Syntax

RegExpObject.source


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 »


RegExp Object Reference JavaScript RegExp Object