From 4289bf1fbb823f410775b4c7d0533b7abd8e5f5f Mon Sep 17 00:00:00 2001 From: 3indblown Leaf <69508345+kraccoon-dev@users.noreply.github.com> Date: Tue, 1 Feb 2022 19:42:11 +0900 Subject: remove class 1 (#3922) --- .../reference/global_objects/regexp/exec/index.html | 10 +++++----- .../reference/global_objects/regexp/index.html | 18 +++++++++--------- .../reference/global_objects/regexp/regexp/index.html | 4 ++-- .../reference/global_objects/regexp/test/index.html | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'files/ko/web/javascript/reference/global_objects/regexp') diff --git a/files/ko/web/javascript/reference/global_objects/regexp/exec/index.html b/files/ko/web/javascript/reference/global_objects/regexp/exec/index.html index d20573f473..eb02391603 100644 --- a/files/ko/web/javascript/reference/global_objects/regexp/exec/index.html +++ b/files/ko/web/javascript/reference/global_objects/regexp/exec/index.html @@ -26,7 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/exec
regexObj.exec(str)+
regexObj.exec(str)
다음과 같은 예제를 고려해보세요.
-// Match "quick brown" followed by "jumps", ignoring characters in between +// Match "quick brown" followed by "jumps", ignoring characters in between // Remember "brown" and "jumps" // Ignore case let re = /quick\s(brown).+?(jumps)/ig; @@ -131,7 +131,7 @@ let result = re.exec('The Quick Brown Fox Jumps Over The Lazy Dog');If your regular expression uses the "
-g
" flag, you can use theexec()
method multiple times to find successive matches in the same string. When you do so, the search starts at the substring ofstr
specified by the regular expression's {{jsxref("RegExp.lastIndex", "lastIndex")}} property ({{jsxref("RegExp.prototype.test()", "test()")}} will also advance the {{jsxref("RegExp.lastIndex", "lastIndex")}} property). For example, assume you have this script:var myRe = /ab*/g; +var myRe = /ab*/g; var str = 'abbcdefabh'; var myArray; while ((myArray = myRe.exec(str)) !== null) { @@ -143,7 +143,7 @@ while ((myArray = myRe.exec(str)) !== null) {This script displays the following text:
-Found abb. Next match starts at 3 +Found abb. Next match starts at 3 Found ab. Next match starts at 9@@ -153,7 +153,7 @@ Found ab. Next match starts at 9You can also use
-exec()
without creating a {{jsxref("RegExp")}} object:var matches = /(hello \S+)/.exec('This is a hello world!'); +var matches = /(hello \S+)/.exec('This is a hello world!'); console.log(matches[1]);diff --git a/files/ko/web/javascript/reference/global_objects/regexp/index.html b/files/ko/web/javascript/reference/global_objects/regexp/index.html index 5675812788..166000e61a 100644 --- a/files/ko/web/javascript/reference/global_objects/regexp/index.html +++ b/files/ko/web/javascript/reference/global_objects/regexp/index.html @@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp다음의 세 표현식은 모두 같은 정규 표현식을 생성합니다.
-/ab+c/i +/ab+c/i new RegExp(/ab+c/, 'i') // 리터럴 new RegExp('ab+c', 'i') // 생성자@@ -46,7 +46,7 @@ new RegExp('ab+c', 'i') // 생성자예를 들어 다음 두 줄은 동일한 정규 표현식을 생성합니다.
-let re = /\w+/ +let re = /\w+/ let re = new RegExp('\\w+')Perl 형태의
@@ -121,7 +121,7 @@ let re = new RegExp('\\w+')RegExp
속성대치 문자열에는
-$1
과$2
를 사용하여 정규 표현식 패턴의 각 괄호에 일치한 결과를 받아옵니다.let re = /(\w+)\s(\w+)/ +let re = /(\w+)\s(\w+)/ let str = 'John Smith' let newstr = str.replace(re, '$2, $1') console.log(newstr)@@ -132,7 +132,7 @@ console.log(newstr)기본 줄 바꿈 문자는 플랫폼(Unix, Windows 등)마다 다릅니다. 아래의 분할 스크립트는 모든 플랫폼의 줄 바꿈을 인식합니다.
-let text = 'Some text\nAnd some more\r\nAnd yet\rThis is the end' +let text = 'Some text\nAnd some more\r\nAnd yet\rThis is the end' let lines = text.split(/\r\n|\r|\n/) console.log(lines) // logs [ 'Some text', 'And some more', 'And yet', 'This is the end' ]@@ -140,7 +140,7 @@ console.log(lines) // logs [ 'Some text', 'And some more', 'And yet', 'This is t여러 줄에서 정규 표현식 사용하기
-let s = 'Please yes\nmake my day!' +let s = 'Please yes\nmake my day!' s.match(/yes.*day/); // Returns null @@ -152,7 +152,7 @@ s.match(/yes[^]*day/);{{JSxRef("Global_Objects/RegExp/sticky", "sticky")}} 플래그는 해당 정규 표현식이 접착 판별, 즉 {{jsxref("RegExp.prototype.lastIndex")}}에서 시작하는 일치만 확인하도록 할 수 있습니다.
-let str = '#foo#' +let str = '#foo#' let regex = /foo/y regex.lastIndex = 1 @@ -165,7 +165,7 @@ regex.lastIndex // 0 (reset after match failure)접착 플래그
-y
의 일치는 정확히lastIndex
위치에서만 발생할 수 있으나, 전역 플래그g
의 경우lastIndex
또는 그 이후에서도 발생할 수 있습니다.re = /\d/y; +re = /\d/y; while (r = re.exec("123 456")) console.log(r, "AND re.lastIndex", re.lastIndex); // [ '1', index: 0, input: '123 456', groups: undefined ] AND re.lastIndex 1 @@ -181,7 +181,7 @@ while (r = re.exec("123 456")) console.log(r, "AND re.lastIndex", re.lastIndex);러시아어나 히브리어와 같은 다른 언어의 문자까지 일치하려면
-\uhhhh
(이때 hhhh는 해당 문자의 16진법 Unicode 값) 문법을 사용하세요. 아래 예제에서는 문자열에서 Unicode 문자를 추출합니다.let text = 'Образец text на русском языке' +let text = 'Образец text на русском языке' let regex = /[\u0400-\u04FF]+/g let match = regex.exec(text) @@ -198,7 +198,7 @@ console.log(regex.lastIndex) // logs '15'URL에서 서브도메인 추출하기
-let url = 'http://xxx.domain.com' +let url = 'http://xxx.domain.com' console.log(/[^.]+/.exec(url)[0].substr(7)) // logs 'xxx'diff --git a/files/ko/web/javascript/reference/global_objects/regexp/regexp/index.html b/files/ko/web/javascript/reference/global_objects/regexp/regexp/index.html index 387b5bceff..a5ed17a62c 100644 --- a/files/ko/web/javascript/reference/global_objects/regexp/regexp/index.html +++ b/files/ko/web/javascript/reference/global_objects/regexp/regexp/index.html @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/RegExp리터럴, 생성자, 팩토리 표기법이 가능합니다.
-/pattern/flags +/pattern/flags new RegExp(pattern[, flags]) RegExp(pattern[, flags])@@ -73,7 +73,7 @@ RegExp(pattern[, flags])다음의 세 표현식은 모두 같은 정규 표현식을 생성합니다.
-/ab+c/i +/ab+c/i new RegExp(/ab+c/, 'i') // 리터럴 new RegExp('ab+c', 'i') // 생성자diff --git a/files/ko/web/javascript/reference/global_objects/regexp/test/index.html b/files/ko/web/javascript/reference/global_objects/regexp/test/index.html index 07569e7eaf..8a4b200e5f 100644 --- a/files/ko/web/javascript/reference/global_objects/regexp/test/index.html +++ b/files/ko/web/javascript/reference/global_objects/regexp/test/index.html @@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/test구문
-regexObj.test(str)+regexObj.test(str)매개변수
@@ -48,7 +48,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/test문자열의 맨 처음에
-"hello"
가 포함됐는지 알아보는 간단한 예제 코드입니다.const str = 'hello world!'; +const str = 'hello world!'; const result = /^hello/.test(str); console.log(result); // true @@ -56,7 +56,7 @@ console.log(result); // true다음은 일치 여부에 따라 다른 메시지를 기록하는 예제입니다.
-function testInput(re, str) { +function testInput(re, str) { let midstring; if (re.test(str)) { midstring = 'contains'; @@ -81,7 +81,7 @@ console.log(result); // true이 행동에 대한 예제가 다음 코드입니다.
-const regex = /foo/g; // the "global" flag is set +const regex = /foo/g; // the "global" flag is set // regex.lastIndex is at 0 regex.test('foo') // true -- cgit v1.2.3-54-g00ecf