Skip to content

GoCelesteAI/python_regular_expressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Python Regular Expressions

Source code for Python Tutorial for Beginners #26 - Regular Expressions.

Files

  • regex_basics.pyre.search(), re.match(), re.findall(), raw strings, metacharacters (\d, \w, \s)
  • patterns_groups.py — Character classes, quantifiers, capturing groups, named groups, re.sub(), re.compile()
  • text_processor.py — Mini project: email validation, phone extraction, log parsing, text cleanup

Running

python3 regex_basics.py
python3 patterns_groups.py
python3 text_processor.py

Topics Covered

  • The re module for pattern matching
  • re.search() to find patterns anywhere in text
  • re.match() to check the start of a string
  • re.findall() to extract all occurrences
  • Raw strings (r"...") to keep backslashes literal
  • Metacharacters: \d, \w, \s, ., ^, $
  • Character classes [a-z] and negation [^0-9]
  • Quantifiers: *, +, ?, {n}, {n,m}
  • Capturing groups () and named groups (?P<name>...)
  • re.sub() for substitution
  • re.compile() for reusable patterns

About

Python Tutorial for Beginners #26 - Regular Expressions (re, search, findall, match, groups)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages