Syntax
regexp.compile(pattern, flag)
The compile() method of the RegExp object compiles a regular expression object.
The creation of the object takes pattern and flags parameters.
The pattern is a valid regular expression.
The flags are either or both g (global) and i (ignore case).
<html>
<body>
<script language="JavaScript">
<!--
var myPat = new RegExp("dd", "i");
var newPat = myPat.compile(myPat);
function getinfo(){
document.form1.text1.value = newPat;
}
-->
</script>
<form name="form1">
Click the button below to get the pattern for the following
command: new RegExp("dd", "i");
<br><br><br>
Compiled Pattern: <input type="text" name="text1" size=30>
<br><br>
<input type="button" value="Get Pattern" onClick='getinfo()'>
</form>
</body>
</html>