Basic HTML version of Foils prepared 3 March 99

Foil 73 Static Properties of RegExp Object I

From Overview of JavaScript I -- Basic Web Scripting Language CPS616 Technologies of the Information Age -- Spring Semester 99. by Geoffrey C. Fox (Tom Scavo)


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>



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Mar 3 1999