diff options
author | 3indblown Leaf <69508345+kraccoon-dev@users.noreply.github.com> | 2022-02-01 19:42:11 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 19:42:11 +0900 |
commit | 4289bf1fbb823f410775b4c7d0533b7abd8e5f5f (patch) | |
tree | 624a9bf236fff00b97fc8c61a76b672333303427 /files/ko/web/javascript/reference/global_objects/regexp/index.html | |
parent | 41bbbf1ce8a34763e6ecc099675af29fb5bef62e (diff) | |
download | translated-content-4289bf1fbb823f410775b4c7d0533b7abd8e5f5f.tar.gz translated-content-4289bf1fbb823f410775b4c7d0533b7abd8e5f5f.tar.bz2 translated-content-4289bf1fbb823f410775b4c7d0533b7abd8e5f5f.zip |
remove class 1 (#3922)
Diffstat (limited to 'files/ko/web/javascript/reference/global_objects/regexp/index.html')
-rw-r--r-- | files/ko/web/javascript/reference/global_objects/regexp/index.html | 18 |
1 files changed, 9 insertions, 9 deletions
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 <p>다음의 세 표현식은 모두 같은 정규 표현식을 생성합니다.</p> -<pre class="brush: js notranslate">/ab+c/i +<pre class="brush: js ">/ab+c/i new RegExp(/ab+c/, 'i') // 리터럴 new RegExp('ab+c', 'i') // 생성자 </pre> @@ -46,7 +46,7 @@ new RegExp('ab+c', 'i') // 생성자 <p>예를 들어 다음 두 줄은 동일한 정규 표현식을 생성합니다.</p> -<pre class="brush: js notranslate">let re = /\w+/ +<pre class="brush: js ">let re = /\w+/ let re = new RegExp('\\w+')</pre> <h3 id="Perl_형태의_RegExp_속성">Perl 형태의 <code>RegExp</code> 속성</h3> @@ -121,7 +121,7 @@ let re = new RegExp('\\w+')</pre> <p>대치 문자열에는 <code>$1</code>과 <code>$2</code>를 사용하여 정규 표현식 패턴의 각 괄호에 일치한 결과를 받아옵니다.</p> -<pre class="brush: js notranslate">let re = /(\w+)\s(\w+)/ +<pre class="brush: js ">let re = /(\w+)\s(\w+)/ let str = 'John Smith' let newstr = str.replace(re, '$2, $1') console.log(newstr)</pre> @@ -132,7 +132,7 @@ console.log(newstr)</pre> <p>기본 줄 바꿈 문자는 플랫폼(Unix, Windows 등)마다 다릅니다. 아래의 분할 스크립트는 모든 플랫폼의 줄 바꿈을 인식합니다.</p> -<pre class="brush: js notranslate">let text = 'Some text\nAnd some more\r\nAnd yet\rThis is the end' +<pre class="brush: js ">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' ]</pre> @@ -140,7 +140,7 @@ console.log(lines) // logs [ 'Some text', 'And some more', 'And yet', 'This is t <h3 id="여러_줄에서_정규_표현식_사용하기">여러 줄에서 정규 표현식 사용하기</h3> -<pre class="brush: js notranslate">let s = 'Please yes\nmake my day!' +<pre class="brush: js ">let s = 'Please yes\nmake my day!' s.match(/yes.*day/); // Returns null @@ -152,7 +152,7 @@ s.match(/yes[^]*day/); <p>{{JSxRef("Global_Objects/RegExp/sticky", "sticky")}} 플래그는 해당 정규 표현식이 접착 판별, 즉 {{jsxref("RegExp.prototype.lastIndex")}}에서 시작하는 일치만 확인하도록 할 수 있습니다.</p> -<pre class="brush: js notranslate">let str = '#foo#' +<pre class="brush: js ">let str = '#foo#' let regex = /foo/y regex.lastIndex = 1 @@ -165,7 +165,7 @@ regex.lastIndex // 0 (reset after match failure)</pre> <p>접착 플래그 <code>y</code>의 일치는 정확히 <code>lastIndex</code> 위치에서만 발생할 수 있으나, 전역 플래그 <code>g</code>의 경우 <code>lastIndex</code> 또는 그 이후에서도 발생할 수 있습니다.</p> -<pre class="brush: js notranslate">re = /\d/y; +<pre class="brush: js ">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); <p>러시아어나 히브리어와 같은 다른 언어의 문자까지 일치하려면 <code>\uhhhh</code>(이때 hhhh는 해당 문자의 16진법 Unicode 값) 문법을 사용하세요. 아래 예제에서는 문자열에서 Unicode 문자를 추출합니다.</p> -<pre class="brush: js notranslate">let text = 'Образец text на русском языке' +<pre class="brush: js ">let text = 'Образец text на русском языке' let regex = /[\u0400-\u04FF]+/g let match = regex.exec(text) @@ -198,7 +198,7 @@ console.log(regex.lastIndex) // logs '15' <h3 id="URL에서_서브도메인_추출하기">URL에서 서브도메인 추출하기</h3> -<pre class="brush: js notranslate">let url = 'http://xxx.domain.com' +<pre class="brush: js ">let url = 'http://xxx.domain.com' console.log(/[^.]+/.exec(url)[0].substr(7)) // logs 'xxx'</pre> <div class="blockIndicator note"> |