Javascript Regexp Exec Method

The exec() method of regexp object search for a match in a specified string. Use it for example to get match in a specified string.

Syntax

regexObj.exec(str)

Javascript Regexp Exec Method Example1

<HTML>
<TITLE>Example of Regexp Object</TITLE>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
var zip_exp = /(techstrikers )/;
var matches = zip_exp.exec('techstrikers world');
document.write(matches );
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

This will produce following result

techstrikers ,techstrikers