Regular Expressions: A Mysterious Introduction

preview_player
Показать описание
Regular Expressions are a super power for searching and matching text with patterns. This interactive mystery introduction assumes no prior knowledge of regular expressions. Click "Show More" for the links to VS Code and the mystery puzzle text files you'll need to follow along. Subscribe for notifications when the next parts in this series are released!

The first of three fundamental regular expressions (regexps) is introduced in this video, the "and then" (concatenation) operator. Three special characters are also introduced: the end of line anchor "$", start of line anchor "^", and the any character ".".

About me: Hey, hey! I'm Kris Jordan (he/him/his), a professor who teaches computer science at the University of North Carolina at Chapel Hill. Back when I first tried to learn regular expressions it felt like a lot of weird, cryptic incantations to memorize. I couldn't separate the essential concepts to understand from the merely convenient shorthand add-ons. When I was was taught their theoretical basis, I struggled to connect academic notation and abstract examples with real-world syntax and concrete applications. So I'm teaching this for you the way I wish regular expressions were introduced to me: fundamentals-first with the syntax of modern applications in an actively hands-on, follow-along style.

If you enjoy learning, or being refreshed on, useful applications of fundamental ideas in computer science, data science, and software engineering, I encourage you to Subscribe to my channel so you can follow along as new lessons are added on a variety of subjects you'll find valuable!
Рекомендации по теме
Комментарии
Автор

Kris, your videos are crystal clear both visually and conceptually. Awesome and thank you

sethurk
Автор

wow, I love this video. Thank you so much for all the little bits of information and definitions like what is Git, and where the word concatenation comes from. It makes it easier to remember. please keep a great attitude.

eddydecolombia
Автор

very clear video, through the 3rd video, solve my problem. I try to search the webpage a whole morning, but it is hard to understand. but your example is simple, clear. thank you very much

姜伟-ty
Автор

Once you go regex, you never go back...

Great video, a lot of mundane office work can be automated with scripts that rely on regex and other tools, that's the power of programming!

mehmethatip
Автор

Love this kris, comp 211 is in the right hands next year!

sameerrao
Автор

Holy cow this is great! I've been brushing up on regex with grep to process text files on my mac. Took me a while to figure out how to take my member's list from YouTube and pull out just the names and drop the lines with Lv, month, day and just give me names. Now I'm trying to process a file has the transcript from a text chat that has the number for the comment, some weird text that doesn't mean anything, and then the actually comment. I was wondering if you could help me or point me to a video of yours that maybe removes the weird line and then combines the number and the comment on a single line. For instance the format is this

1
00:00:00, 000 --> 00:00:05, 000
Merge Music and Film: Uh oh...

2
00:00:00, 000 --> 00:00:05, 000
Nanc: Good morning 🙂

3
00:00:00, 000 --> 00:00:05, 000
Aaron in Aus: Goof morning all 🙂

and basically output something like

1 - Merge Music and Film: Uh oh...
2 - Nanc: Good morning 🙂
3 - Aaron in Aus: Goof morning all 🙂

I'm using grep on macOS in a terminal window. Heck if you could point me in the direction of a doc or book that would be extremely helpful! Unfortunately it's been decades since I was living in Unix so I know this is possible my old brain just doesn't remember where to look.

The closest I've been able to get, while giving myself a major headache, is

grep "\S" "Live Stream on 2020-11-05 at 06.01.32.srt" | grep -v "00:00"

Which gives me
1
Merge Music and Film: Uh oh...

I'm looking forward to binge watching this series of yours!

DSD
Автор

Text searching works roughly the same in Atom too. Anyway regex is awesome, I've used it a lot for text replacement as a wiki editor as well as in programmer to text-mine data.

ericschneider
join shbcf.ru