From the course: Learning Regular Expressions
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Solution: Lookaround assertions - Regular Expressions Tutorial
From the course: Learning Regular Expressions
Solution: Lookaround assertions
(upbeat music) - [Instructor] I hope that you were successful at the lookaround assertions challenge. If you ran into problems, I'm going to walk you through the solutions that I came up with. From the exercise files, I opened up us_presidents.csv and I'm going to copy all of that and paste it into my browser so that I can work with it. Now, the first task was to match the line for every U.S. president. The simplest and crudest way to do that is just to use some anchors for the beginning and ends of the line and just use a wild card to match everything. Now that matches too much. You can see it matches the header at the top. I know that I'm also going to be wanting to target specific portions of this CSV file. Those commented limited values and the commas are good guideposts for knowing which of the different sections are on each line. There's no commas used anywhere except as separators. So I can tease out the seven…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.