search()

Description :

This methods returns a new string found in the given string. Always returns first occurence of the matched string.

It is similar to indexOf() method but where you can pass only search string. Here you can use regular expression also

Syntax :

string.search(SearchString)

Input Parameters :

SearchString
The string to be searched in the given string. It can be a regular expression as well

Return Values :

Return a new string if found otherwise returns -1


Test this method :

Regular Expression Search (e.g. /u/i)
Test Result :   
Your Code :