Add condition where string is not found

updates to search function