Latest web development tutorials

JavaScript source property

RegExp Object Reference JavaScript RegExp Object

Definition and Usage

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

grammar

RegExpObject.source


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support source property.


Examples

Examples

Returns regular pattern matching text:

<script>

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

</script>

try it"


RegExp Object Reference JavaScript RegExp Object