JavaScript sourceProperty
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.
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 »
JavaScript RegExp Object Other Extensions