쉐도잉 연습: [Practice Problems] Regular Expressions (Regex) - Visually Explained - 영상으로 영어 말하기 배우기

레슨 만드는 중...
1
Have you tried our regular expressions practice exercises?
2
If you have, great!
3
We're going to work through the solutions now.
4
If not, the problems are linked in the description.
5
Alright, let's start with problem one.
6
In this problem, we want to match all the phone numbers from the bulletin board text.
7
Each phone number follows the format.
8
A fixed area code, and a hyphen, followed by three digits, another hyphen, and a final four digits.
9
Since every phone number starts with the same area code and hyphen, we write the literal characters 1, 2, 3, hyphen directly into the pattern box.
10
Next, the middle group of numbers can have any combination of three digits.
11
To match this, we use the character class 0 through 9 to match a single digit
12
and follow it with the quantifier 3 to match exactly 3.
13
Following the character class, we write another literal hyphen.
14
To match the last four digits, like the middle three, we use a character class with 0 through 9.
15
But to match four digits instead of 3, we use a quantifier of 4.
16
Great!
17
As we can see, this pattern matches both phone numbers and our bulletin board text.
18
Fixed quantifiers like 3 and 4 are ideal when you know the exact length you're looking for.
19
Phone numbers, zip codes, product codes, anything with a predictable structure.
20
Quantifiers will also be quite useful in problem 2.
21
In this problem, we want to write a regular expression to match all the prices in our text string.
22
each price starts with a dollar sign followed by one
23
or more digits a dot
24
and exactly two digits for cents you might be tempted to start by writing the literal dollar sign character
25
but in regex dollar sign is a special syntax
26
that means end of line
27
so it won't match the dollar sign character to match a
28
literal dollar sign we put a backslash in front of it after the dollar sign comes the digits before the decimal,
29
which we can match using a character class with 0 through 9.
30
Since there could be any number of digits before the decimal, we use the plus quantifier to match one or more digits.
31
Following this character class, we specify a dot.
32
Remember, like the dollar sign, the dot is special syntax, called a wildcard, that matches any single character.
33
To use a literal dot character, we need to write a backslash before it.
34
Finally, cents always have exactly two digits.
35
To match this, we write a character class allowing the digits 0 through 9 and a quantifier of 2.
36
Awesome!
37
With this pattern, all five prices are matched.
38
Before we move on, we've now written the character class containing 0 through 9 several times.
39
Since this is such a common pattern, regex syntax actually provides a shorthand for it.
40
Instead of explicitly writing the character class, we write backslash d, which also means any digit.
41
Awesome, our pattern is now more concise and we still get the same matches.
42
We'll use the digit shorthand backslash d again in problem 3.
43
In this problem, we want to match all the dates in the text.
44
Each date has a month name, a day number, and a four-digit year.
45
We'll start by matching the month names.
46
Month names are made up of letters, both upper and lowercase, so we'll use a character class of all the uppercase and lowercase letters.
47
To match one or more letters, we follow the class with the plus quantifier.
48
After the month name comes a literal space.
49
After the space, the day can be one digit or two.
50
To match exactly one or two digits,
51
we use the backslash d shorthand followed by a range quantifier with a lower bound of one and upper bound of two.
52
Following the day, we write a literal comma and space.
53
Lastly, the year is always four digits, so we write the digit shorthand and a quantifier of four.
54
Awesome!
55
With that pattern, we've matched all the dates.
56
With these practice problems, you've seen how to write patterns for three different data types.
57
If you want to go deeper on any of the concepts we used in this video, check out our regular expressions intro video linked in the description.
58
We're working on lots more Python explainer videos like this one, so be sure to subscribe so that you don't miss out.
59
If you have any questions or topics that you'd like to learn about, let us know in the comments below.
60
We'd love to hear from you.
61
Thanks for watching!

이 수업에 대하여

이번 수업에서는 정규 표현식(Regex)에 대해 배우고, 다양한 예제를 통해 실습을 진행할 것입니다. 유튜브 영어 공부를 통해 정규 표현식을 활용하여 전화번호, 가격, 날짜를 추출하는 방법을 익히고, 이를 실제 텍스트에서 어떻게 적용할 수 있는지를 살펴볼 것입니다. 이 과정은 규칙적인 구조를 가진 데이터를 다루는 데 매우 유용합니다. 특히, IELTS 스피킹 시험을 준비하는 학습자에게는 실용적인 언어 실력이 향상될 수 있습니다.

핵심 어휘 및 구문

  • 정규 표현식 (Regex): 데이터 패턴을 찾고 매칭하기 위한 문법입니다.
  • 전화번호: 특정 형식에 맞춘 전화번호를 매칭하는 예제입니다.
  • 가격: 달러 기호와 숫자를 포함하는 가격을 추출하는 방법입니다.
  • 숫자 집합: 0부터 9까지의 숫자를 포함하는 문자 클래스를 의미합니다.
  • 양적 기호: 특정 숫자의 개수를 지정하는 정규 표현식의 요소입니다.
  • 문자 클래스: 특정 범위의 문자를 매칭하기 위한 정규 표현식의 구성요소입니다.

연습 팁

영어 말하기 연습을 위해 이번 비디오에서는 shadow speech 또는 shadowspeak 방식으로 접근하는 것을 추천합니다. 원어민의 발음을 따라 하며 비디오 속 내용을 다시 반복해 보세요. 특히, 이 비디오의 속도와 톤에 맞추어 연습하면 더욱 효과적입니다. 초반에 조금 느리게 따라 하다가 점차 원래 속도로 연습하는 것이 좋습니다. 또한, 각 예제의 문장을 소리 내어 읽으며 shadow speak하는 방식은 발음과 억양을 자연스럽게 익히는 데 큰 도움이 됩니다. 반복적으로 연습하며 자신감을 잃지 않는 것이 중요합니다.

쉐도잉이란? 영어 실력을 빠르게 키우는 과학적 방법

쉐도잉(Shadowing)은 원래 전문 통역사 훈련을 위해 개발된 언어 학습 기법으로, 다언어 학자인 Dr. Alexander Arguelles에 의해 대중화된 방법입니다. 핵심 원리는 간단하지만 매우 강력합니다: 원어민의 영어를 들으면서 1~2초의 짧은 지연으로 즉시 소리 내어 따라 말하는 것——마치 '그림자(shadow)'처럼 화자를 따라가는 것입니다. 문법 공부나 수동적인 청취와 달리, 쉐도잉은 뇌와 입 근육이 동시에 실시간으로 영어를 처리하고 재현하도록 훈련합니다. 연구에 따르면 이 방법은 발음 정확도, 억양, 리듬, 연음, 청취력, 말하기 유창성을 크게 향상시킵니다. IELTS 스피킹 준비와 자연스러운 영어 소통을 원하는 분들에게 특히 효과적입니다.