| 2249 | ) |
| 2250 | |
| 2251 | def _get_res(val, ipat, imaxcount=maxcount, dtype=self._obj.dtype): |
| 2252 | if ipat.groups == 0: |
| 2253 | raise ValueError("No capture groups found in pattern.") |
| 2254 | matches = ipat.findall(val) |
| 2255 | res = np.zeros([maxcount, ipat.groups], dtype) |
| 2256 | |
| 2257 | if ipat.groups == 1: |
| 2258 | for imatch, match in enumerate(matches): |
| 2259 | res[imatch, 0] = match |
| 2260 | else: |
| 2261 | for imatch, match in enumerate(matches): |
| 2262 | for jmatch, submatch in enumerate(match): |
| 2263 | res[imatch, jmatch] = submatch |
| 2264 | |
| 2265 | return res |
| 2266 | |
| 2267 | return duck_array_ops.astype( |
| 2268 | self._apply( |