METHOD:  RegExp.test

This method tests for a match of a regular expression in a string, returning true if successful, and false if not. The test method can be used with either a string literal or a string variable. For example, the following code tests for a match of the regular expression 'er' in the string "the fisherman", returning an appropriate message if a match is found (which in this case it is).
rexp = /er/
if(rexp.test("the fisherman"))
   document.write("It's true, I tell you.")

If no string is declared with this method, then the value of RegExp.input is used.

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information