JavaScript sourceProperty

RegExp 对象参考手册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.


Examples

Examples

Return the text that matches the regular expression pattern:

var str="Visit EXAMPLE"; var patt1=/RUN/g; document.write("The text of the RegExp is: "+patt1.source);

Try it Yourself »


RegExp 对象参考手册JavaScript RegExp Object Other Extensions