On this page
  1. re.fullmatch
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

re.fullmatch

Prev: re.finditer | Up: re | Next: re.match
Rel: re.compile, re.error, re.escape, re.findall
Ref: docs.python.org — re.fullmatch
Tags: #public #python3 #stdlib #re


Import

import re
from re import fullmatch

Signature & Overview

re.fullmatch(pattern, string, flags=0)

Try to apply the pattern to all of the string, returning a Match object, or None if no match was found.

Usage

import re

assert re.fullmatch(r"\d{4}", "2026") is not None
assert re.fullmatch(r"\d{4}", "2026-extra") is None

Gotchas

REPL Inspect

from re import fullmatch
help(fullmatch)

Linked from

Related notes