#100DaysOfCode in Python Transcripts
Chapter: Days 28-30: Regular Expressions
Lecture: Second day: write your own regexes

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Welcome back to 100 days of Python.
0:02 This is the second day of the 3 day regEx blog.
0:05 And today I want to give you some pointers
0:08 to get more familiar with regxxes
0:11 and start to write your own.
0:13 So we did an article,
0:15 10 Tips to Get More Out of Your RegExes.
0:18 I recommend you read through it.
0:20 One thing I didn't touch on is greediness,
0:23 which is important and can prevent nasty bugs.
0:27 And if you're still more a beginner in regex land,
0:31 there's a nice talk at the end by Al Sweigart.
0:35 Who by the way wrote an awesome Python beginner book,
0:39 called How to Automate the Boring Stuff,
0:40 and it's called Yes, It's Time to Learn
0:42 Regular Expressions.
0:43 And that gives you a very nice overview
0:46 of regular expressions.
0:48 Secondly, there's a nice how-to on the
0:51 Python documentation page.
0:53 Very refreshing how-to.
0:54 I read this when I wrote the 10 Tips post,
0:56 it's pretty dense, but it is a very good
0:59 primer into regular expression,
1:01 and what all the specific syntaxes mean, etc.
1:07 If that's too much reading, which I can totally get,
1:10 there's a nice online RegEx tester.
1:13 And you just select Python,
1:16 and you can write here your regular expression,
1:18 and test it in real time.
1:20 For example, I have some HTML with two paragraphs.
1:23 And let's experiment a little bit
1:25 with that greediness I mentioned.
1:28 So let's match all of it.
1:31 So that's greediness because it takes everything
1:34 from the starting paragraph tag to the ending one.
1:38 If I do a question mark, the match becomes shorter.
1:41 It only takes the first paragraph.
1:43 And you see all this nice feedback and explanations here.
1:47 So that's a really great tool to experiment
1:50 writing regular expressions in Python,
1:53 because you get instant feedback.
1:55 So that will be the third resource I have for you today.
1:59 Just spend 20 or 30 minutes experimenting with regexes,
2:03 and you'll see that they become a lot easier.
2:06 Good luck.