LANGUAGE » PYTHON » PACKAGE

Regex

Replace

python
import re

re.sub(r'regex', repl, text, count=0)
python
import re

iter_obj = re.finditer(r'<img.*?[^>]>', text)
match_obj = re.search(r'upload_id=(\d+)', html_tag)

match_obj.group(0)  # The whole match
match_obj.group(1)  # Capturing group 1