Skip to content

Latest commit

 

History

History
60 lines (52 loc) · 1.7 KB

File metadata and controls

60 lines (52 loc) · 1.7 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
source Property (Regular Expression) (JavaScript) | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
source
JavaScript
TypeScript
DHTML
Source property
d58ac57e-fcde-49d1-bbba-e8c4218448c4
9
mikejo5000
mikejo
ghogen

source Property (Regular Expression) (JavaScript)

Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal.

Syntax

  
rgExp.source  

Example

The following example illustrates the use of the source property:

function SourceDemo(re, s){  
   var s1;  
   // Test string for existence of regular expression.  
   if (re.test(s))  
      s1 = " contains ";  
   else  
      s1 = " does not contain ";  
   // Get the text of the regular expression itself.  
   return(s + s1 + re.source);  
}  

Requirements

[!INCLUDEjsv3]

Applies To: Regular Expression Object

See Also

Regular Expression Object
Regular Expression Object
Regular Expression Syntax (JavaScript)