This is one of the additions to the String object to support regular expressions.
The character location where the match occurred is returned. If there is no match then the value -1 is returned instead.
If you use the global attribute ('g'), then it will be ignored.
This resets the lastIndex property of a RegExp object to 0.
Don't mix this search() method up with the search property that belongs to the Location object as they are totally different things. The temptation might be to refer to the position that the string search yielded as a location. This could be very confusing for someone working on your scripts later on.