1 |
RegExp.input or RegExp.$_ is text which we are comparing regular expression with
-
It is set automatically in some circumstances (e.g. when event handle for Form text field called as in example below)
-
<SCRIPT LANGUAGE="JavaScript1.2">
-
function getInfo() {
-
re = /(\w+)\s(\d+)/;
-
re.exec();
-
window.alert(RegExp.$1 + ", your age is " + RegExp.$2); }
-
</SCRIPT>
-
Enter your first name and your age, and then press Enter.
-
<FORM>
-
<INPUT TYPE:"TEXT" NAME="NameAge" onChange="getInfo(this);">
-
</FORM>
|