9951 explained code solutions for 126 technologies


pythonHow to find all matches with regex


import re
found = re.findall('[0-9]', 'I was 10 when I was a child')ctrl + c
import re

module to work with regular expressions

found

will contain list of found matches

findall

returns all found matches

[0-9]

example regular expression (matches all difits)

I was 10 when I was a child

example string to extract matches from