Lesson Plan-27
Emp Code: GUSCSE202433218
Emp Name: Sapna Gupta
Course Code: K1UL304T
Course Name: Python Programming
Semester: III
Academic Year: 2025
Title of lesson:Search and Replace, Regular Expressions, and Wildcards
Aims: To develop students’ understanding of text manipulation using search,
replace, and pattern-matching techniques in Python through Regular Expressions
and Wildcards.
Learning Outcomes: By the end of this lesson, Students will be able to:
1. Explain the concept of search and replace operations in text processing.
2. Use the re module to perform pattern matching using Regular Expressions.
3. Apply wildcards and regex patterns to filter or modify text dynamically.
Activities Duration
Recap Recall string operations (concatenation, slicing, find). 5 mins
Opening A. What the students will do 3+2
(Engaging “How can we automatically find and modify specific words in a long min
text file?”
question to
open the
B. How you (the teacher) will facilitate or scaffold
lecture + student learning
Stating the Introduce lesson objectives — search and
LO) replace, regex, and wildcard concepts.
Rationale For This Activity
Activates prior knowledge and introduces the
idea of pattern-based searching.
Activity 1: [Link] the students will do 15 min
Write a Python program:
Demonstrat
ion + text = "Python is fun. I love Python."
Guided updated = [Link]("Python", "Java")
Practice print(updated)
[Link] you (the teacher) will facilitate or scaffold
student learning
Demonstrate .replace() method and show its limitations (e.g.,
case-sensitivity).
[Link] For This Activity
Introduces basic text manipulation before moving to regex.
Activity 2: A. What the students will do 15 min
Use Python re module for pattern matching:
import re
text = "My phone number is 9876543210."
pattern = r"\d{10}"
result = [Link](pattern, text)
print([Link]())
B. How you (the teacher) will facilitate or scaffold
student learning
Explain symbols like \d, \w, +, * and use
examples.
C. Rationale For This Activity
Helps students identify patterns and extract data using regular
expressions.
Conclusion A. What the students will do 5 min
Wrap-up Answer: “When should we use regex instead of simple replace?”
B. How you (the teacher) will facilitate or scaffold
student learning
Summarize key ideas — .replace(), [Link](), [Link](),
and wildcard symbols.
C. Rationale For This Activity
Reinforces learning and connects concepts to data cleaning and
text analysis.