# Basic matching
email = "user@example.com"
email =~ /@/ # => 4 (position of match)
email.match?(/@/) # => true
# Capture groups
import spacy
from spacy.matcher import Matcher
nlp = spacy.load('en_core_web_sm')
matcher = Matcher(nlp.vocab)
matcher.add('INCIDENT_ID', [[{'TEXT': {'REGEX': '^INC-[0-9]{6}$'}}]])
import re
text = 'INC-102301 resolved on 2026-04-06 after payment failure for order ORD-99182.'
patterns = {
'incident_id': r'INC-[0-9]{6}',