Find out how many times a regex matches in a string in Python

import re
len(re.findall(pattern, string_to_search))

Leave a Comment