• 회원가입
  • 로그인
  • 구글아이디로 로그인

[RegExp] JS - (x|y) 의미 - x나 y 포함 검사 (소괄호안수직바, 정규표현식 괄호)

(x|y) 예제

 

<button onclick="test()">결과 보기</button>


<p id="hz"></p>


<script>

function test() {

    var str = "Homzzang.com is a best Homepage.";

    var patt =/(hom|best)/g;

    var result = str.match(patt);

    document.getElementById("hz").innerHTML = result;

}

</script>



결과 보기

 


분류 제목
Conversion JS - function(){} 타입변환 - (숫자: NaN , 문자열: "function(){}" , 참…
Conversion JS - { } 타입변환 - (숫자: NaN , 문자열: "[object Object]" , 참거짓: tru…
Conversion JS - null 타입변환 - (숫자: 0 , 문자열: "null" , 참거짓: false)
Conversion JS - undefined 타입변환 - (숫자: NaN , 문자열: "undefined" , 참거짓: fal…
DOM_Attribute JS - Attribute Object -
DOM_Attribute JS - attribute.isId 속성 - 속성이 아이디유형인지 반환. (모든 브라우저 지원X)
DOM_Attribute JS - attr.name -
DOM_Attribute JS - attr.value - 요소 속성값 반환/설정 (= value속성 = 밸류속성)
DOM_Attribute JS - attr.specified -
DOM_Attribute JS - nodemap.getNamedItem() 메서드 -
DOM_Attribute JS - nodemap.item() 메서드 -
DOM_Attribute JS - nodemap.length -
DOM_Attribute JS - nodemap.removeNamedItem() 메서드 -
DOM_Attribute JS - nodemap.setNamedItem() 메서드 -
DOM_Attribute JS - attr.appendChild() 메서드 - 사용금지
DOM_Attribute JS - attr.attributes - 사용금지
DOM_Attribute JS - attr.baseURI - 사용금지
DOM_Attribute JS - attr.childNodes - 사용금지
DOM_Attribute JS - attr.cloneNode() 메서드 - 사용금지
DOM_Attribute JS - attr.firstChild -
20/67
목록
찾아주셔서 감사합니다. Since 2012