#100DaysOfCode in Python Transcripts
Chapter: Days 28-30: Regular Expressions
Lecture: Concepts: what did we learn

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So, let's do a quick wrap of what we've learned so far.
0:04 When to not use regexes.
0:07 Well if simple string operations do, use those.
0:12 Re.search versus re.match,
0:14 re.match matches the whole string,
0:16 re.search matches part of the string.
0:19 Those are probably the main methods
0:21 you will be using on the re module.
0:24 Capturing parentheses,
0:25 to access part of the match use parentheses
0:29 and you can use groups on the matching object
0:33 to get to the string.
0:35 Your new best friend findall, one of my favorites.
0:38 To get all the occurrences of a pattern in a string,
0:42 you can us findall and I showed you two examples.
0:45 One is to get all the days or numbers out of the string
0:50 and it returns a list, and findall combined with counter
0:54 one line of code a lot of stuff gets done.
0:57 Compile for regexes, so you can use re.compile
1:00 to compile a regex to use over and over again.
1:04 And you can add a verbose switch to make regular expressions
1:08 none space sensitive so you can line 'em out
1:13 over multiple lines, making 'em more readable.
1:17 String replacements, resub.
1:19 Again if you can use string replace do that
1:21 but sometimes the pattern you want to match
1:24 is more sophisticated and you need a regular expression.
1:27 The way to use read outsub methods
1:30 is to define your pattern.
1:34 Again I prefer you using a raw string
1:37 to not to escape the back slashes.
1:41 And the second argument is to put in your replacement.
1:44 And here's a little bit more advanced example.
1:47 Where you use capturing parentheses to
1:49 port part of the matching string
1:51 to the replacement arguments.
1:54 And now it's your turn.