|
| 1 | +# Day 19: Regular Expressions 🔍 |
| 2 | + |
| 3 | +Welcome to Day 19! Today, we're diving into the world of Regular Expressions (RegEx) – a powerful tool for pattern matching and string manipulation. With RegEx, you can search, extract, and validate strings with precision. Let’s get started! |
| 4 | + |
| 5 | +## Tasks/Activities 📝 |
| 6 | + |
| 7 | +### Activity 1: Basic Regular Expressions |
| 8 | + |
| 9 | +- [ ] **Task 1:** Write a regular expression to match a simple pattern (e.g., match all occurrences of the word "JavaScript" in a string). Log the matches. |
| 10 | +- [ ] **Task 2:** Write a regular expression to match all digits in a string. Log the matches. |
| 11 | + |
| 12 | +### Activity 2: Character Classes and Quantifiers |
| 13 | + |
| 14 | +- [ ] **Task 3:** Write a regular expression to match all words in a string that start with a capital letter. Log the matches. |
| 15 | +- [ ] **Task 4:** Write a regular expression to match all sequences of one or more digits in a string. Log the matches. |
| 16 | + |
| 17 | +### Activity 3: Grouping and Capturing |
| 18 | + |
| 19 | +- [ ] **Task 5:** Write a regular expression to capture the area code, central office code, and line number from a US phone number format (e.g., (123) 456-7890). Log the captures. |
| 20 | +- [ ] **Task 6:** Write a regular expression to capture the username and domain from an email address. Log the captures. |
| 21 | + |
| 22 | +### Activity 4: Assertions and Boundaries |
| 23 | + |
| 24 | +- [ ] **Task 7:** Write a regular expression to match a word only if it is at the beginning of a string. Log the matches. |
| 25 | +- [ ] **Task 8:** Write a regular expression to match a word only if it is at the end of a string. Log the matches. |
| 26 | + |
| 27 | +### Activity 5: Practical Applications |
| 28 | + |
| 29 | +- [ ] **Task 9:** Write a regular expression to validate a simple password (must include at least one uppercase letter, one lowercase letter, one digit, and one special character). Log whether the password is valid. |
| 30 | +- [ ] **Task 10:** Write a regular expression to validate a URL. Log whether the URL is valid. |
| 31 | + |
| 32 | +## Feature Request 🎯 |
| 33 | + |
| 34 | +1. **Basic Regex Script:** Write a script that uses regular expressions to match simple patterns and log the matches. |
| 35 | +2. **Character Classes and Quantifiers Script:** Create a script that uses regular expressions to match words with specific characteristics and log the matches. |
| 36 | +3. **Grouping and Capturing Script:** Write a script that uses regular expressions to capture parts of a string, such as phone numbers and email addresses, and log the captures. |
| 37 | +4. **Assertions and Boundaries Script:** Create a script that uses regular expressions to match words at specific positions in a string and log the matches. |
| 38 | +5. **Validation Script:** Write a script that uses regular expressions to validate passwords and URLs and log whether they are valid. |
| 39 | + |
| 40 | +## Achievement 🏆 |
| 41 | + |
| 42 | +By the end of these activities, students will: |
| 43 | + |
| 44 | +- ✅ Understand and create **basic regular expressions**. |
| 45 | +- ✅ Use **character classes and quantifiers** in regular expressions. |
| 46 | +- ✅ Implement **grouping and capturing** in regular expressions. |
| 47 | +- ✅ Apply **assertions and boundaries** in regular expressions. |
| 48 | +- ✅ Use regular expressions for **practical applications** like validating passwords and URLs. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +Happy Coding! 🎯 |
0 commit comments