Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[과제번역] Part9. 9.10 과제 번역 (#1672) #1673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

The result is: `match:123 4`.
정답: `match:123 4`

First the lazy `pattern:\d+?` tries to take as little digits as it can, but it has to reach the space, so it takes `match:123`.
첫 번째 `pattern:\d+?` 는 가능한 적은 숫자를 가지려고 하지만 공백에 닿게 되어 `match:123`을 가집니다.

Then the second `\d+?` takes only one digit, because that's enough.
두 번째 `\d+?`는 조건을 만족했기 때문에 한 개의 숫자만 가지게 됩니다.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# A match for /d+? d+?/
# /d+? d+?/와 일치하는 것은 무엇일까요?

What's the match here?
여기서 어떤 것들이 일치할까요?

```js
"123 456".match(/\d+? \d+?/g); // ?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
We need to find the beginning of the comment `match:<!--`, then everything till the end of `match:-->`.
주석의 시작 `match:<!--`부터, `match:-->`로 끝나는 모든 것을 찾아야 합니다.

An acceptable variant is `pattern:<!--.*?-->` -- the lazy quantifier makes the dot stop right before `match:-->`. We also need to add flag `pattern:s` for the dot to include newlines.
게으른 수량자(가능한 한 적게 찾는 - 옮긴이)는 점이 `match:-->`직전에 멈추게 하므로 허용할 수 있는 변형은 `pattern:<!--.*?-->`입니다. 또한, 점이 줄 바꿈을 포함할 수 있도록 `pattern:s`플래그를 추가합니다.

Otherwise multiline comments won't be found:
그렇지 않으면, 여러 줄로 구성된 주석들을 찾을 수 없습니다.

```js run
let regexp = /<!--.*?-->/gs;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Find HTML comments
# HTML 주석들을 찾아보세요.

Find all HTML comments in the text:
문자열에서 모든 HTML 주석들을 찾아보세요.

```js
let regexp = /your regexp/g;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

The solution is `pattern:<[^<>]+>`.
정답은 `pattern:<[^<>]+>`입니다.

```js run
let regexp = /<[^<>]+>/g;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Find HTML tags
# HTML 태그들을 찾아 보세요

Create a regular expression to find all (opening and closing) HTML tags with their attributes.
HTML의 프로퍼티를 포함한 모든 태그(열리고 닫히는)를 찾기 위한 정규표현식을 작성하세요.

An example of use:
예제:

```js run
let regexp = /your regexp/g;
Expand All @@ -12,4 +12,4 @@ let str = '<> <a href="/"> <input type="radio" checked> <b>';
alert( str.match(regexp) ); // '<a href="/">', '<input type="radio" checked>', '<b>'
```

Here we assume that tag attributes may not contain `<` and `>` (inside squotes too), that simplifies things a bit.
단순화하기 위해 태그의 프로퍼티들은 `<``>`을 포함하지 않는다고 가정합니다. (프로퍼티의 값 내부에서도)