Hi, I'm Peter Chapman, and welcome to the first Office Hours
for CS 262 Building a Web Browser.
I'm your assistant instructor, and I'm filling in for Professor Westley Weimer,
who's currently at a conference.
My name's Andy.
I'm the assistant instructor for CS 212,
which is Peter Norvig's class on the design of computer programs.
And I'm going to be filling in the role of the student today
and asking Peter here
all of the questions that you came up with in the forums.
So let's start off.
The first question we had, Peter, was why are we learning regular expressions at all?
Why is this useful for a class on programming languages?
The class is structured around building a web browser,
and our web browser needs to interpret html.
The first step to do that is to identify the parts of html.
We want to identify which part is the beginning of a tag,
the end of a tag, what's a hyperlink, what's just text and words and whatnot.
We want to do that very concisely
with the powerful tool that is regular expressions.
Regular expression just allows you to write some text,
and it very precisely and easily identifies
strings that can match, say, our tags or hyperlinks.
Okay, and I've seen the beginning of Unit 2,
and it seems like that gets reintroduced then.
Yeah, we use it a lot throughout the course.
こんにちはピーター・チャップマンです
1回目のオフィスアワー
Webブラウザ構築のクラスにようこそ
私はアシスタント講師でワイマー教授の代行です
教授は現在会議に出席しています
私はアンディです
私はピーター・ノーヴィグ氏の
コンピュータプログラムデザインのクラス
CS 212のアシスタント講師です
今日は生徒役として
ここにいるピーターに
皆さんがフォーラムで出した質問を聞いていきます
では始めましょう
最初の質問です
なぜ私たちは正規表現について学ぶのですか?
これがどうプログラミング言語のクラスで
役に立つのでしょうか?
このクラスはWebブラウザの構築を
目的としています
WebブラウザはHTMLを解釈する必要があります
そのための最初のステップは
HTMLの各部分を理解することです
タグの始まりと終わり、ハイパーリンクとは何か
どれがただのテキストや単語なのか
などを見分けたいのです
それを正規表現という強力なツールを使って
簡潔にできるのです
正規表現を使ってテキストを書くと
正確にそして簡単に
タグやハイパーリンクに一致する文字列を
認識してくれます
なるほど レッスン2の初めを見ましたが
そこでまた紹介されるようですね
そうです
このコースを通してかなり頻繁に出てきます
Oi, eu sou Peter Chapman, e Bem-Vindo para o primeiro horário de expediente
para a CS 262 Construindo um Web Browser.
Eu sou seu instrutor assistente, e eu estou preenchendo a ausência do Professor Westley Weimer,
que está atualmente em uma conferência.
Meu nome é Andy.
Eu sou o instrutor assistente para a CS 212,
que é a classe de Peter Norvig sobre a concepção de programas de computador.
E eu vou estar preenchendo o papel do estudante de hoje
e perguntando a Peter aqui
todas as perguntas que vocês fizeram nos fóruns.
Então vamos começar.
A primeira pergunta que teve, Peter, foi por que que estamos aprendendo expressões regulares em tudo?
Por que isso é útil para uma aula sobre linguagens de programação?
A classe está estruturado em torno da construção de um navegador web,
e nosso navegador precisa interpretar html.
O primeiro passo para fazer isso é identificar as partes do html.
Queremos identificar qual parte é o início de uma tag,
o fim de uma tag, o que é um hiperlink, o que é apenas o texto e palavras e outros enfeites.
Nós queremos fazer isso muito conciso
com a ferramenta poderosa que é expressões regulares.
Expressão regular apenas permite que você escreva um texto,
e de forma muito precisa e fácil identifica
sequências de caracteres que podem combinar, por exemplo, nossas tags ou hiperlinks.
Ok, e eu vi o começo da Unidade 2,
e parece que será reintroduzida então.
Sim, as utilizamos muito ao longo do curso.