From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript RegExp Object
The test() method tests for a match in a string.
This method returns true if it finds a match, otherwise it returns false.
| RegExpObject.test(string) |
| Parameter | Description |
|---|---|
| string | Required. The string to be searched |
ExampleDo a global search, and test for "Hello" and "W3Schools" in a string:
The output of the code above will be:
Try it yourself » |
JavaScript RegExp Object
From http://www.w3schools.com (Copyright Refsnes Data)