JS有一个RegExp.RegExp.test( ): test whether a string matches a pattern
ECMAScript v3
24.159.1. Synopsis
regexp.test(string)24.159.1.1. Arguments
stringThe string to be tested.24.159.1.2. Returns
true if string contains text that matches regexp; false otherwise.24.159.1.3. Throws
TypeErrorIf this method is invoked on an object that is not a RegExp.24.159.2. Description
test( ) tests string to see if it contains text that matches regexp. If so, it returns true; otherwise, it returns false. Calling the test( ) method of a RegExp r and passing it the string s is equivalent to the following expression:(r.exec(s) != null)24.159.3. Example
var pattern = /java/i;
pattern.test("JavaScript");   // Returns true
pattern.test("ECMAScript");   // Returns false24.159.4. See Also
RegExp.exec( ), RegExp.lastIndex, String.match( ), String.replace( ), String.substring( ); Chapter 11  
---------------------------------------------
MSN:[email protected]请给我一个与您交流的机会!