From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript String Object
The search() method searches for a match between a regular expression and a string.
This method returns the position of the match, or -1 if no match is found.
| stringObject.search(regexp) |
| Parameter | Description |
|---|---|
| regexp | Required. A regular expression object. Read more about the RegExp object |
Example 1Perform a case-sensitive search:
The output of the code above will be:
Try it yourself » |
Example 2Perform a case-insensitive search:
The output of the code above will be:
Try it yourself » |
JavaScript String Object
From http://www.w3schools.com (Copyright Refsnes Data)