A default string to search when the exec() and test() methods are called with no arguments.
You can set this and then call the RegExp.exec() or RegExp.test() methods without passing a string argument value. They will then use this property of the built-in global RegExp object as their target search string.
This behaves slightly differently in JavaScript version 1.2 in Netscape Navigator.
Since this is a class property (a static property), it belongs to the global built-in RegExp object. This means it is shared by all RegExp object instances and therefore is very transient and will be overwritten as soon as the next regular expression is evaluated. If you want to preserve the value, you will need to copy it immediately your regular expression has evaluated and before you call another.
In Netscape 4, event handlers for FormElement objects in a web page form automatically load the input property of the built-in RegExp object as the event handlers are fired. Hence, you should not rely on the input property remaining consistent once your function call exits. Set it immediately before you need to parse the string and do not bank on it being there later.
This property was not supported fully in IE 4 as it was read-only. The work-around was to always pass in a value to the exec() method when it is invoked.
See also: | RegExp.exec(), RegExp.test() |
Prev | Home | Next |
RegExp.index | Up | RegExp.lastIndex |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |