Description:
The exec method searches string for text that matches regexp. If it finds a match, it returns an array of results; otherwise, it returns null.Syntax:
RegExpObject.exec( string ); |
- string : The string to be searched
Return Value:
Returns the matched text if a match is found, and null if not.Example:
<html>
<head>
<title>JavaScript RegExp exec Method</title>
</head>
<body>
<script type="text/javascript">
var str = "Javascript is an interesting scripting language";
var re = new RegExp( "script", "g" );
var result = re.exec(str);
document.write("Test 1 - returned value : " + result);
re = new RegExp( "pushing", "g" );
var result = re.exec(str);
document.write("<br />Test 2 - returned value : " + result);
</script>
</body>
</html>
|
Test 1 - returned value : script Test 2 - returned value : null
+JavaScript +JavaScript Frameworks Links +Javascript Development +JavaScript's and More, Software and Marketing +JavascriptU +JavaScriptOn +Javascript Problems +JavaScriptOn +javaScript is a creek in West Virginia in the summe +enJineS +JavascriptU +Javascript Tutor





![jQuery - unbind( [type], [fn] ) Method jQuery - unbind( [type], [fn] ) Method](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3D1qokr9vvAl30ch5jCwh7uv0pD-iBNyRvRw8sUlAc9n4jFJgWAkB4By1x7O93HrcYOR3snmoWhxAL1peRQUm1BBz9Eez86ayKWzf1jXYoKTiFmlwVRzQF4a_RFHr5kdbPGA3quto7Xo/s72-c/images.jpeg)
No comments: