search() method searches for a match between a regular expression and a specified string, returning the index of the first match.
syntax ↴
search(regexp) ↴
regexp A regular expression object, or any object that has a Symbol.search method.
If regexp is not a RegExp object and does not have a Symbol.search method, it is implicitly converted to a RegExp.
search() method returns the index (position) of the first match.
search() method returns -1 if no match is found.
search() method is case sensitive.
If the search value is a string, it is converted to a regular expression.
search() and indexOf() are similar, except ↴
search() cannot take a start position argument.
indexOf() method can take a start position argument but cannot search against a regular expression.
myString.search(regexp)