JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow RegExp Right Arrow source

source  RegExp  instance property

Description

Returns the text of the pattern.

Syntax


Signature Description
aRegExp.sourceReturns the text of the pattern.

Parameters

None.

Examples

The code below displays the source property of some RegExp instances.


var aRegExp = /\d/;
var bRegExp = /[^A-Za-z0-9_]/;
var regexpValues = new Array(2);
regexpValues[0] = 'aRegExp source: ' + aRegExp.source + '\n';
regexpValues[1] = 'bRegExp source: ' + bRegExp.source;
alert(regexpValues);

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 9 - Regular Expressions



  

go to home page Homepage go to top of page Top