How to use 'python re find first' in Python

Every line of 'python re find first' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
337def findall(self, string, pos=0, endpos=None):
338 # Return a list of all non-overlapping matches of pattern in string.
339 if not endpos is None:
340 string = string[:endpos]
341 all = []
342 while True:
343 m = self.search(string, pos)
344 if m is None:
345 break
346 span = m.span()
347 if not m.groups():
348 all.append(string[span[0]:span[1]])
349 else:
350 all.append(tuple([group or '' for group in m.groups()]))
351 pos = span[1]
352 return all
353 # Next line bugs in FF2
354 return list(string[pos:].match(self.findall_code))

Related snippets