Count Regex Matches

Count how many times a regex pattern matches in a string.

Code

General
import re
return len(re.findall(pattern, str))

Parameters

String to search

Pattern to count

Server

More Python Snippets