add new feature: return pattern pos