RegExp.input

The string against which a regular expression is matched. $_ is another name for the same property.

Property of RegExp
Static

Description

Because input is static, it is not a property of an individual regular expression object. Instead, you always use it as RegExp.input.

If no string argument is provided to a regular expression's exec or test methods, and if RegExp.input has a value, its value is used as the argument to that method.

The script or the browser can preset the input property. If preset and if no string argument is explicitly provided, the value of input is used as the string argument to the exec or test methods of the regular expression object. input is set by the browser in the following cases:

  • When an event handler is called for a TEXT form element, input is set to the value of the contained text.
  • When an event handler is called for a TEXTAREA form element, input is set to the value of the contained text. Note that multiline is also set to true so that the match can be executed over the multiple lines of text.
  • When an event handler is called for a SELECT form element, input is set to the value of the selected text.
  • When an event handler is called for a Link object, input is set to the value of the text between <A HREF=...> and </A>.

The value of the input property is cleared after the event handler completes.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.