Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Objects
RegExp Object
METHOD: RegExp.test
object.
test
([str])
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).
Code:
rexp = /er/
if(rexp.test("the fisherman"))
document.write("It's true, I tell you.")
Output:
It's true, I tell you.
NOTE:
If no string is declared with this method, then the value of
RegExp.input
is used.
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information