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
Input Parameters :
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 :