searching for pattern from position defined in startPosition parameter.