Regular Expressions (Regex)

Regular Expressions are used to search, match, and manipulate text patterns.

🔍 Regex is powerful for validation and searching.

Basic Example

import re

text = "My phone number is 9876543210"
result = re.search("\\d{10}", text)
print(result.group())

Common Functions

  • re.search()
  • re.findall()
  • re.sub()