use cow array for capture groups