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/index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'files/ko/web/javascript/reference/global_objects/regexp/index.html') 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  형태의 RegExp 속성

@@ -121,7 +121,7 @@ let re = new RegExp('\\w+')

대치 문자열에는 $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'
-- cgit v1.2.3-54-g00ecf