- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the role of source RegExp property in JavaScript?
The source RegExp property in JavaScript is a read-only string property of RegExp objects. It contains the text of the RegExp pattern. This text does not include the delimiting slashes used in regular-expression literals, and it does not include the "g", "i", and "m" attributes.
Example
You can try to run the following code to learn how to implement source RegExp property in JavaScript −
<html> <head> <title>JavaScript RegExp source Property</title> </head> <body> <script> var str = "JavaScript is an interesting scripting language"; var re = new RegExp( "script", "g" ); re.test(str); document.write("The regular expression is : " + re.source); </script> </body> </html>
Advertisements