From 4d549ee1a6984bccb767792b38a26ee43231cf11 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:44:37 +0900 Subject: [PATCH 01/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 7bf9894711..5b95d1c171 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,9 +1,9 @@ # Escaping, special characters -As we've seen, a backslash `pattern:\` is used to denote character classes, e.g. `pattern:\d`. So it's a special character in regexps (just like in regular strings). +본 바와 같이, 백슬래쉬 `pattern:\`는 글자 클래스를 나타내는데 사용됩니다, 예 : `pattern:\d`.그래서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). -There are other special characters as well, that have special meaning in a regexp. They are used to do more powerful searches. Here's a full list of them: `pattern:[ \ ^ $ . | ? * + ( )`. +정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 입니다 : `pattern:[ \ ^ $ . | ? * + ( )`. Don't try to remember the list -- soon we'll deal with each of them separately and you'll know them by heart automatically. From e914196630aaadb6d0aea9bc012678c8aeb66cc2 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:45:15 +0900 Subject: [PATCH 02/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 5b95d1c171..d32228cc56 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,7 +1,7 @@ # Escaping, special characters -본 바와 같이, 백슬래쉬 `pattern:\`는 글자 클래스를 나타내는데 사용됩니다, 예 : `pattern:\d`.그래서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). +본 바와 같이, 백슬래쉬 `pattern:\`는 글자 클래스를 나타내는데 사용됩니다, 예 : `pattern:\d`. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). 정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 입니다 : `pattern:[ \ ^ $ . | ? * + ( )`. From 2c57eca060b8b0c75c64699b1c1aadce38751904 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:54:55 +0900 Subject: [PATCH 03/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index d32228cc56..ac681a8270 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,5 +1,5 @@ -# Escaping, special characters +# 이스케이프, 특수 문자 본 바와 같이, 백슬래쉬 `pattern:\`는 글자 클래스를 나타내는데 사용됩니다, 예 : `pattern:\d`. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). From 2b60ed0ea8136bf54c06b7c001e2fba4394fa8c7 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Fri, 26 Nov 2021 18:39:21 +0900 Subject: [PATCH 04/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index ac681a8270..42600d7e3c 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -5,7 +5,7 @@ 정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 입니다 : `pattern:[ \ ^ $ . | ? * + ( )`. -Don't try to remember the list -- soon we'll deal with each of them separately and you'll know them by heart automatically. +곧 리스트를 각각 다룰 것이고 자동적으로 알게 될 것이기 때문에 기억하려고 하지 않아도 됩니다. ## Escaping From 2c586782d97d343fb0c4a133704c588eb736d319 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Fri, 26 Nov 2021 20:39:40 +0900 Subject: [PATCH 05/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 42600d7e3c..9f69e90833 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -7,11 +7,11 @@ 곧 리스트를 각각 다룰 것이고 자동적으로 알게 될 것이기 때문에 기억하려고 하지 않아도 됩니다. -## Escaping +## 이스케이프 -Let's say we want to find literally a dot. Not "any character", but just a dot. +문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 '.'을 찾습니다. -To use a special character as a regular one, prepend it with a backslash: `pattern:\.`. +특수 문자를 일반 문자로 사용하려면, 백슬래쉬 앞에 '.'을 붙입니다 : `pattern:\.`. That's also called "escaping a character". From f520a9c65847971e35b5a48f50753da49fda0804 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Fri, 26 Nov 2021 21:15:48 +0900 Subject: [PATCH 06/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 9f69e90833..d31ad8c37b 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -11,7 +11,7 @@ 문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 '.'을 찾습니다. -특수 문자를 일반 문자로 사용하려면, 백슬래쉬 앞에 '.'을 붙입니다 : `pattern:\.`. +특수 문자를 일반 문자로 사용하려면, 백슬래쉬를 앞에 붙입니다 : `pattern:\.`. That's also called "escaping a character". From f22cde453f2868b0ce85d33f049d0c09689a6e98 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 16:02:40 +0900 Subject: [PATCH 07/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index d31ad8c37b..b65ddaf2ca 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -3,7 +3,7 @@ 본 바와 같이, 백슬래쉬 `pattern:\`는 글자 클래스를 나타내는데 사용됩니다, 예 : `pattern:\d`. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). -정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 입니다 : `pattern:[ \ ^ $ . | ? * + ( )`. +정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. 곧 리스트를 각각 다룰 것이고 자동적으로 알게 될 것이기 때문에 기억하려고 하지 않아도 됩니다. @@ -11,7 +11,7 @@ 문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 '.'을 찾습니다. -특수 문자를 일반 문자로 사용하려면, 백슬래쉬를 앞에 붙입니다 : `pattern:\.`. +특수 문자를 일반 문자로 사용하려면, '.' 앞에 백슬래쉬를`pattern:\.` 붙입니다 : `pattern:\.`. That's also called "escaping a character". From 78528f26b47de697494bcc21d93316518980348c Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 16:28:02 +0900 Subject: [PATCH 08/21] Update article.md --- .../07-regexp-escaping/article.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index b65ddaf2ca..d07c5eb1f4 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,7 +1,7 @@ # 이스케이프, 특수 문자 -본 바와 같이, 백슬래쉬 `pattern:\`는 글자 클래스를 나타내는데 사용됩니다, 예 : `pattern:\d`. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). +본 바와 같이 백슬래쉬 `pattern:\`는 문자 클래스(`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). 정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. @@ -9,16 +9,16 @@ ## 이스케이프 -문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 '.'을 찾습니다. +문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 점을 찾습니다. -특수 문자를 일반 문자로 사용하려면, '.' 앞에 백슬래쉬를`pattern:\.` 붙입니다 : `pattern:\.`. +특수 문자를 일반 문자로 사용하려면, 점 앞에 백슬래쉬`pattern:\.`를 붙입니다. -That's also called "escaping a character". +"탈출문자"이라고도 합니다. -For example: +예시: ```js run -alert( "Chapter 5.1".match(/\d\.\d/) ); // 5.1 (match!) -alert( "Chapter 511".match(/\d\.\d/) ); // null (looking for a real dot \.) +alert( "Chapter 5.1".match(/\d\.\d/) ); // 5.1 (일치 항목!) +alert( "Chapter 511".match(/\d\.\d/) ); // null (진짜 점\.를 찾고 있습니다) ``` Parentheses are also special characters, so if we want them, we should use `pattern:\(`. The example below looks for a string `"g()"`: From 4e4aa99c24c67751a201e91e3ac8fa8be5566380 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 16:42:29 +0900 Subject: [PATCH 09/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index d07c5eb1f4..d5d9ca762e 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,7 +1,7 @@ # 이스케이프, 특수 문자 -본 바와 같이 백슬래쉬 `pattern:\`는 문자 클래스(`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). +본 바와 같이 백슬래쉬 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). 정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. @@ -21,7 +21,7 @@ alert( "Chapter 5.1".match(/\d\.\d/) ); // 5.1 (일치 항목!) alert( "Chapter 511".match(/\d\.\d/) ); // null (진짜 점\.를 찾고 있습니다) ``` -Parentheses are also special characters, so if we want them, we should use `pattern:\(`. The example below looks for a string `"g()"`: +괄호도 특수 문자이기 때문에 `pattern:\(`를 사용해야 합니다. 아래 예제에서 문자열`"g()"`를 찾습니다.: ```js run alert( "function g()".match(/g\(\)/) ); // "g()" From 4acfe7915d59cb470c85167730aab4113e43f9cb Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 16:48:41 +0900 Subject: [PATCH 10/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index d5d9ca762e..aca108ad8b 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,7 +1,7 @@ # 이스케이프, 특수 문자 -본 바와 같이 백슬래쉬 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). +본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). 정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. @@ -11,9 +11,9 @@ 문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 점을 찾습니다. -특수 문자를 일반 문자로 사용하려면, 점 앞에 백슬래쉬`pattern:\.`를 붙입니다. +특수 문자를 일반 문자로 사용하려면, 점 앞에 백슬래시`pattern:\.`를 붙입니다. -"탈출문자"이라고도 합니다. +"탈출문자"라고도 합니다. 예시: ```js run @@ -27,15 +27,15 @@ alert( "Chapter 511".match(/\d\.\d/) ); // null (진짜 점\.를 찾고 있습 alert( "function g()".match(/g\(\)/) ); // "g()" ``` -If we're looking for a backslash `\`, it's a special character in both regular strings and regexps, so we should double it. +백슬래시 `\`를 찾고 있다면 일반 문자열과 정규 표현식에서 모두 특수 문자이기 때문에 두 번 작성해야 합니다. ```js run alert( "1\\2".match(/\\/) ); // '\' ``` -## A slash +## 슬래시 -A slash symbol `'/'` is not a special character, but in JavaScript it is used to open and close the regexp: `pattern:/...pattern.../`, so we should escape it too. +ㅅ`'/'` is not a special character, but in JavaScript it is used to open and close the regexp: `pattern:/...pattern.../`, so we should escape it too. Here's what a search for a slash `'/'` looks like: From cb25f3d6428285ce6094b59736a5d5a137ecd565 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 19:29:49 +0900 Subject: [PATCH 11/21] Update article.md --- .../07-regexp-escaping/article.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index aca108ad8b..1d2942499f 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,9 +1,9 @@ # 이스케이프, 특수 문자 -본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규 표현식의 특수문자 입니다. (일반 문자열도 해당). +본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규식의 특수문자 입니다. (일반 문자열도 해당). -정규 표현식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. +정규식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. 곧 리스트를 각각 다룰 것이고 자동적으로 알게 될 것이기 때문에 기억하려고 하지 않아도 됩니다. @@ -13,7 +13,7 @@ 특수 문자를 일반 문자로 사용하려면, 점 앞에 백슬래시`pattern:\.`를 붙입니다. -"탈출문자"라고도 합니다. +"문자 이스케이프"라고도 합니다. 예시: ```js run @@ -27,7 +27,7 @@ alert( "Chapter 511".match(/\d\.\d/) ); // null (진짜 점\.를 찾고 있습 alert( "function g()".match(/g\(\)/) ); // "g()" ``` -백슬래시 `\`를 찾고 있다면 일반 문자열과 정규 표현식에서 모두 특수 문자이기 때문에 두 번 작성해야 합니다. +백슬래시 `\`를 찾고 있다면 일반 문자열과 정규식에서 모두 특수 문자이기 때문에 두 번 작성해야 합니다. ```js run alert( "1\\2".match(/\\/) ); // '\' @@ -35,25 +35,25 @@ alert( "1\\2".match(/\\/) ); // '\' ## 슬래시 -ㅅ`'/'` is not a special character, but in JavaScript it is used to open and close the regexp: `pattern:/...pattern.../`, so we should escape it too. +슬래시`'/'`기호는 특수 문자가 아니지만 자바스크립트에서는 정규표현식: `pattern:/...pattern.../`을 열고 닫는데 사용하기 때문에 이 문자도 이스케이프 해야 합니다. -Here's what a search for a slash `'/'` looks like: +슬래시`'/'`를 찾는 방법은 다음과 같습니다. ```js run alert( "/".match(/\//) ); // '/' ``` -On the other hand, if we're not using `pattern:/.../`, but create a regexp using `new RegExp`, then we don't need to escape it: +다른 방법으로 `pattern:/.../`을 사용하지 않고 `new RegExp`로 새로운 정규식을 만들 때 이스케이프 시킬 필요가 없습니다. ```js run alert( "/".match(new RegExp("/")) ); // finds / ``` -## new RegExp +## 새로운 정규식 -If we are creating a regular expression with `new RegExp`, then we don't have to escape `/`, but need to do some other escaping. +`new RegExp`으로 새로운 정규 표현식을 만드는 경우 `/`를 이스케이프 할 필요가 없지만 다른 이스케이프 처리를 해야 합니다. -For instance, consider this: +위 내용을 고려하여 예를 들어봅시다. ```js run let regexp = new RegExp("\d\.\d"); @@ -61,23 +61,23 @@ let regexp = new RegExp("\d\.\d"); alert( "Chapter 5.1".match(regexp) ); // null ``` -The similar search in one of previous examples worked with `pattern:/\d\.\d/`, but `new RegExp("\d\.\d")` doesn't work, why? +이전의 유사한 예제`pattern:/\d\.\d/`는 잘 작동했지만 `new RegExp("\d\.\d")`는 작동하지 않는데 왜 그럴까요? -The reason is that backslashes are "consumed" by a string. As we may recall, regular strings have their own special characters, such as `\n`, and a backslash is used for escaping. +백슬래시는 문자열에 의해 "소비"되기 때문입니다. 기억하듯이 일반 문자열에는 `\n`과 같은 각자의 특수 문자가 있으며 백슬래시는 이스케이프에 사용됩니다. -Here's how "\d\.\d" is preceived: +"\d\.\d"의 예를 보겠습니다. ```js run alert("\d\.\d"); // d.d ``` -String quotes "consume" backslashes and interpret them on their own, for instance: +예시된 다음 문자열은 백슬래시를 "소비"하고 해석하는데 살펴 봅시다. -- `\n` -- becomes a newline character, -- `\u1234` -- becomes the Unicode character with such code, -- ...And when there's no special meaning: like `pattern:\d` or `\z`, then the backslash is simply removed. +- `\n` -- 줄 바꿈 문자, +- `\u1234` -- 해당 코드를 의미하는 유니코드 문자, +- ...`pattern:\d` 와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거 됩니다. -So `new RegExp` gets a string without backslashes. That's why the search doesn't work! +그래서 `new RegExp`은 백슬래시가 없는 문자열을 받습니다. That's why the search doesn't work! To fix it, we need to double backslashes, because string quotes turn `\\` into `\`: From c491e32f04320621b32077031ab6a8133421cd34 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 19:51:42 +0900 Subject: [PATCH 12/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 1d2942499f..cf2d3e46d5 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -21,13 +21,13 @@ alert( "Chapter 5.1".match(/\d\.\d/) ); // 5.1 (일치 항목!) alert( "Chapter 511".match(/\d\.\d/) ); // null (진짜 점\.를 찾고 있습니다) ``` -괄호도 특수 문자이기 때문에 `pattern:\(`를 사용해야 합니다. 아래 예제에서 문자열`"g()"`를 찾습니다.: +괄호도 특수 문자이기 때문에 `pattern:\(`를 사용해야 합니다. 아래 예제에서 문자열`"g()"`를 찾아 보겠습니다.: ```js run alert( "function g()".match(/g\(\)/) ); // "g()" ``` -백슬래시 `\`를 찾고 있다면 일반 문자열과 정규식에서 모두 특수 문자이기 때문에 두 번 작성해야 합니다. +백슬래시 `\`를 찾고 있다면 일반 문자열과 정규식에서 모두 특수 문자이기 때문에 두 작성해야 합니다. ```js run alert( "1\\2".match(/\\/) ); // '\' @@ -53,7 +53,7 @@ alert( "/".match(new RegExp("/")) ); // finds / `new RegExp`으로 새로운 정규 표현식을 만드는 경우 `/`를 이스케이프 할 필요가 없지만 다른 이스케이프 처리를 해야 합니다. -위 내용을 고려하여 예를 들어봅시다. +위 내용을 고려하여 예를 들어 보겠습니다. ```js run let regexp = new RegExp("\d\.\d"); @@ -71,15 +71,15 @@ alert( "Chapter 5.1".match(regexp) ); // null alert("\d\.\d"); // d.d ``` -예시된 다음 문자열은 백슬래시를 "소비"하고 해석하는데 살펴 봅시다. +문자열 따옴표는 백슬래시를 "소비"하고 해석하는데 예시를 살펴 보겠습니다. - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, - ...`pattern:\d` 와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거 됩니다. -그래서 `new RegExp`은 백슬래시가 없는 문자열을 받습니다. That's why the search doesn't work! +그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 찾을 필요가 없습니다! -To fix it, we need to double backslashes, because string quotes turn `\\` into `\`: +문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 해결하기 이 문제를 위해서는 백슬래시를 두배로 사용해야 합니다. ```js run *!* From 8db7b976459d066de209fc192e367b2ce0dfc17e Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 20:22:53 +0900 Subject: [PATCH 13/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index cf2d3e46d5..ab02900f14 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -77,7 +77,7 @@ alert("\d\.\d"); // d.d - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, - ...`pattern:\d` 와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거 됩니다. -그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 찾을 필요가 없습니다! +그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 검색 할 필요가 없습니다! 문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 해결하기 이 문제를 위해서는 백슬래시를 두배로 사용해야 합니다. @@ -92,8 +92,8 @@ let regexp = new RegExp(regStr); alert( "Chapter 5.1".match(regexp) ); // 5.1 ``` -## Summary +## 요약 -- To search for special characters `pattern:[ \ ^ $ . | ? * + ( )` literally, we need to prepend them with a backslash `\` ("escape them"). +- 특수 문자`pattern:[ \ ^ $ . | ? * + ( )`를 문자 그대로 검색하려면 백슬래시`\` ("escape them")를 앞에 붙여야 합니다. - We also need to escape `/` if we're inside `pattern:/.../` (but not inside `new RegExp`). -- When passing a string `new RegExp`, we need to double backslashes `\\`, cause string quotes consume one of them. +- 문자열`new RegExp`를 전달할 때 문자열 따옴표가 백슬래시 중 한 개를 사용하기 때문에 두배의 백슬래시`\\`가 필요합니다. From f1a8ebbdb145d5d6a783c6d76fe0c0f517404338 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 20:23:23 +0900 Subject: [PATCH 14/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index ab02900f14..ef18b3bca0 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -96,4 +96,4 @@ alert( "Chapter 5.1".match(regexp) ); // 5.1 - 특수 문자`pattern:[ \ ^ $ . | ? * + ( )`를 문자 그대로 검색하려면 백슬래시`\` ("escape them")를 앞에 붙여야 합니다. - We also need to escape `/` if we're inside `pattern:/.../` (but not inside `new RegExp`). -- 문자열`new RegExp`를 전달할 때 문자열 따옴표가 백슬래시 중 한 개를 사용하기 때문에 두배의 백슬래시`\\`가 필요합니다. +- 문자열`new RegExp`을 전달할 때 문자열 따옴표가 백슬래시 중 한 개를 사용하기 때문에 두배의 백슬래시`\\`가 필요합니다. From 6f8dacd578284749e9749c724a65ae885740bdf3 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 20:23:28 +0900 Subject: [PATCH 15/21] Create article.md From 97002f875152b9da323d3e30595390a80424b41f Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:09:26 +0900 Subject: [PATCH 16/21] Update article.md --- .../07-regexp-escaping/article.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index ef18b3bca0..e6e2517122 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,17 +1,17 @@ # 이스케이프, 특수 문자 -본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는데 사용됩니다. 따라서 이는 정규식의 특수문자 입니다. (일반 문자열도 해당). +본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는 데 사용됩니다. 따라서 이는 정규식(일반 문자열과 같이)의 특수 문자입니다. -정규식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트`pattern:[ \ ^ $ . | ? * + ( )` 입니다. +정규식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 `pattern:[ \ ^ $ . | ? * + ( )` 입니다. -곧 리스트를 각각 다룰 것이고 자동적으로 알게 될 것이기 때문에 기억하려고 하지 않아도 됩니다. +리스트를 기억하려 하지 마세요 각각 다룰 것이고 곧 알게 될겁니다. ## 이스케이프 -문자 그대로 '.'을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 점을 찾습니다. +문자 그대로 점을 찾는다고 해봅시다. 모든 글자가 아니라 진짜 점을 찾습니다. -특수 문자를 일반 문자로 사용하려면, 점 앞에 백슬래시`pattern:\.`를 붙입니다. +특수 문자를 일반 문자로 사용하려면, 백슬래시`pattern:\.`를 붙입니다. "문자 이스케이프"라고도 합니다. @@ -21,13 +21,13 @@ alert( "Chapter 5.1".match(/\d\.\d/) ); // 5.1 (일치 항목!) alert( "Chapter 511".match(/\d\.\d/) ); // null (진짜 점\.를 찾고 있습니다) ``` -괄호도 특수 문자이기 때문에 `pattern:\(`를 사용해야 합니다. 아래 예제에서 문자열`"g()"`를 찾아 보겠습니다.: +괄호도 특수 문자이기 때문에 `pattern:\(`를 사용해야 합니다. 아래 예제에서 문자열`"g()"`를 찾아보겠습니다. ```js run alert( "function g()".match(/g\(\)/) ); // "g()" ``` -백슬래시 `\`를 찾고 있다면 일반 문자열과 정규식에서 모두 특수 문자이기 때문에 두 작성해야 합니다. +백슬래시 `\`를 찾고 있다면 일반 문자열과 정규식에서 모두 특수 문자이기 때문에 두 번 작성해야 합니다. ```js run alert( "1\\2".match(/\\/) ); // '\' @@ -35,7 +35,7 @@ alert( "1\\2".match(/\\/) ); // '\' ## 슬래시 -슬래시`'/'`기호는 특수 문자가 아니지만 자바스크립트에서는 정규표현식: `pattern:/...pattern.../`을 열고 닫는데 사용하기 때문에 이 문자도 이스케이프 해야 합니다. +슬래시`'/'`기호는 특수 문자가 아니지만, 자바스크립트에서는 정규 표현식`pattern:/...pattern.../`을 열고 닫는 데 사용하기 때문에 이 문자도 이스케이프 해야 합니다. 슬래시`'/'`를 찾는 방법은 다음과 같습니다. @@ -43,7 +43,7 @@ alert( "1\\2".match(/\\/) ); // '\' alert( "/".match(/\//) ); // '/' ``` -다른 방법으로 `pattern:/.../`을 사용하지 않고 `new RegExp`로 새로운 정규식을 만들 때 이스케이프 시킬 필요가 없습니다. +반면에, `pattern:/.../`을 사용하지 않고 `new RegExp`을 사용해 새로운 정규식을 만든다면 이스케이프 할 필요가 없습니다. ```js run alert( "/".match(new RegExp("/")) ); // finds / @@ -71,15 +71,15 @@ alert( "Chapter 5.1".match(regexp) ); // null alert("\d\.\d"); // d.d ``` -문자열 따옴표는 백슬래시를 "소비"하고 해석하는데 예시를 살펴 보겠습니다. +문자열 따옴표는 백슬래시를 "소비"하고 해석하는데 예시를 살펴보겠습니다. - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, -- ...`pattern:\d` 와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거 됩니다. +- ...`pattern:\d`와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거 됩니다. 그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 검색 할 필요가 없습니다! -문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 해결하기 이 문제를 위해서는 백슬래시를 두배로 사용해야 합니다. +문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 해결하기 이 문제를 위해서는 백슬래시를 두 배로 사용해야 합니다. ```js run *!* From dda522bae89da806823e610db2ed6349b96836a7 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:18:25 +0900 Subject: [PATCH 17/21] Update article.md --- .../07-regexp-escaping/article.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index e6e2517122..d475852705 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -1,11 +1,11 @@ # 이스케이프, 특수 문자 -본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는 데 사용됩니다. 따라서 이는 정규식(일반 문자열과 같이)의 특수 문자입니다. +본 바와 같이 백슬래시 `pattern:\`는 문자 클래스(예:`pattern:\d`)를 나타내는 데 사용됩니다. 따라서 이는 정규식(일반 문자열과 같이)의 특수 문자입니다. -정규식에서 특별한 의미를 가지는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 `pattern:[ \ ^ $ . | ? * + ( )` 입니다. +정규식에서 특별한 의미가 있는 다른 특수 문자도 있습니다. 이는 보다 강력한 검색에 사용됩니다. 다음은 전체 리스트 `pattern:[ \ ^ $ . | ? * + ( )` 입니다. -리스트를 기억하려 하지 마세요 각각 다룰 것이고 곧 알게 될겁니다. +리스트를 기억하려 하지 마세요 각각 다룰 것이고 곧 알게 될 겁니다. ## 이스케이프 @@ -51,7 +51,7 @@ alert( "/".match(new RegExp("/")) ); // finds / ## 새로운 정규식 -`new RegExp`으로 새로운 정규 표현식을 만드는 경우 `/`를 이스케이프 할 필요가 없지만 다른 이스케이프 처리를 해야 합니다. +`new RegExp`으로 새로운 정규 표현식을 만드는 경우 `/`를 이스케이프 할 필요가 없지만 다른 이스케이프 처리해야 합니다. 위 내용을 고려하여 예를 들어 보겠습니다. @@ -75,9 +75,9 @@ alert("\d\.\d"); // d.d - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, -- ...`pattern:\d`와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거 됩니다. +- ...`pattern:\d`와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거됩니다. -그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 검색 할 필요가 없습니다! +그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 검색할 필요가 없습니다! 문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 해결하기 이 문제를 위해서는 백슬래시를 두 배로 사용해야 합니다. @@ -96,4 +96,4 @@ alert( "Chapter 5.1".match(regexp) ); // 5.1 - 특수 문자`pattern:[ \ ^ $ . | ? * + ( )`를 문자 그대로 검색하려면 백슬래시`\` ("escape them")를 앞에 붙여야 합니다. - We also need to escape `/` if we're inside `pattern:/.../` (but not inside `new RegExp`). -- 문자열`new RegExp`을 전달할 때 문자열 따옴표가 백슬래시 중 한 개를 사용하기 때문에 두배의 백슬래시`\\`가 필요합니다. +- 문자열`new RegExp`을 전달할 때 문자열 따옴표가 백슬래시 중 한 개를 사용하기 때문에 두 배의 백슬래시`\\`가 필요합니다. From a7aeb43286dbc9f26bc84530f3fa860bcbcb0b5c Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:19:31 +0900 Subject: [PATCH 18/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index d475852705..5ad9066956 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -71,7 +71,7 @@ alert( "Chapter 5.1".match(regexp) ); // null alert("\d\.\d"); // d.d ``` -문자열 따옴표는 백슬래시를 "소비"하고 해석하는데 예시를 살펴보겠습니다. +문자열 따옴표는 백슬래시를 "소비"하여 해석하는데 예시를 살펴보겠습니다. - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, From 508d5fbf60ab2372045285eaa17f5b6c37cf342e Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:27:22 +0900 Subject: [PATCH 19/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 5ad9066956..6693e7da18 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -53,7 +53,7 @@ alert( "/".match(new RegExp("/")) ); // finds / `new RegExp`으로 새로운 정규 표현식을 만드는 경우 `/`를 이스케이프 할 필요가 없지만 다른 이스케이프 처리해야 합니다. -위 내용을 고려하여 예를 들어 보겠습니다. +예를 들어, 이 경우를 생각해 보세요. ```js run let regexp = new RegExp("\d\.\d"); @@ -71,15 +71,15 @@ alert( "Chapter 5.1".match(regexp) ); // null alert("\d\.\d"); // d.d ``` -문자열 따옴표는 백슬래시를 "소비"하여 해석하는데 예시를 살펴보겠습니다. +문자열 따옴표는 백슬래시를 "소비"하여 문자열 마음대로 해석하는데 예시를 살펴보겠습니다. - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, - ...`pattern:\d`와 `\z`같이 특별한 의미를 갖지 않으면 백슬래시는 제거됩니다. -그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 따로 검색할 필요가 없습니다! +그래서 `new RegExp`는 백슬래시가 없는 문자열을 받습니다. 검색이 동작하지 않는 이유입니다! -문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 해결하기 이 문제를 위해서는 백슬래시를 두 배로 사용해야 합니다. +문자열 따옴표가 `\\`을 `\`으로 바꾸기 때문에 이 문제를 해결하기 위해서는 백슬래시를 두 배로 사용해야 합니다. ```js run *!* @@ -94,6 +94,6 @@ alert( "Chapter 5.1".match(regexp) ); // 5.1 ## 요약 -- 특수 문자`pattern:[ \ ^ $ . | ? * + ( )`를 문자 그대로 검색하려면 백슬래시`\` ("escape them")를 앞에 붙여야 합니다. -- We also need to escape `/` if we're inside `pattern:/.../` (but not inside `new RegExp`). +- 특수 문자`pattern:[ \ ^ $ . | ? * + ( )`를 문자 그대로 검색하려면 백슬래시`\`를 앞에 붙여야 합니다. ("특수 문자 이스케이프 하기") +- `pattern:/.../`안에 사용 된 `/`도 이스케이프 해야 합니다. (`new RegExp`에서는 필요 없습니다). - 문자열`new RegExp`을 전달할 때 문자열 따옴표가 백슬래시 중 한 개를 사용하기 때문에 두 배의 백슬래시`\\`가 필요합니다. From e33372c777a2c6e910cd6fc72c437d142203db09 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:42:40 +0900 Subject: [PATCH 20/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 6693e7da18..12fbe60a4e 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -71,7 +71,7 @@ alert( "Chapter 5.1".match(regexp) ); // null alert("\d\.\d"); // d.d ``` -문자열 따옴표는 백슬래시를 "소비"하여 문자열 마음대로 해석하는데 예시를 살펴보겠습니다. +문자열 따옴표는 백슬래시를 "소비"하여 문장 마음대로 해석하는데 예시를 살펴보겠습니다. - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, From bd36ca6d3d8bb1f9e74164de223448405541f406 Mon Sep 17 00:00:00 2001 From: dntjr970 <33437637+dntjr970@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:43:20 +0900 Subject: [PATCH 21/21] Update article.md --- 9-regular-expressions/07-regexp-escaping/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/9-regular-expressions/07-regexp-escaping/article.md b/9-regular-expressions/07-regexp-escaping/article.md index 12fbe60a4e..06eb5486a6 100644 --- a/9-regular-expressions/07-regexp-escaping/article.md +++ b/9-regular-expressions/07-regexp-escaping/article.md @@ -71,7 +71,7 @@ alert( "Chapter 5.1".match(regexp) ); // null alert("\d\.\d"); // d.d ``` -문자열 따옴표는 백슬래시를 "소비"하여 문장 마음대로 해석하는데 예시를 살펴보겠습니다. +문자열 따옴표는 백슬래시를 "소비"하여 문장을 마음대로 해석하는데 예시를 살펴보겠습니다. - `\n` -- 줄 바꿈 문자, - `\u1234` -- 해당 코드를 의미하는 유니코드 문자, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy