728x90
반응형
match : 반환 (배열)
셀 범위에서 지정된 항목을 검색하고 범위에서 해당 항목이 차지하는 상대 위치를 반환합니다.
// "문자열".search("검색값");
// "문자열".search(정규식 표현);
// "문자열".search("검색값");
// "문자열".search(정규식 표현);
const str1 = "javascript reference";
const currentStr1 = str1.match("javascript"); //javascript
const currentStr2 = str1.match("reference"); //reference
const currentStr3 = str1.match("r"); //r
const currentStr4 = str1.match(/reference/); //reference
const currentStr5 = str1.match(/Reference/); //null
const currentStr6 = str1.match(/Reference/i); //reference
const currentStr7 = str1.match(/r/g); //'r', 'r', 'r' 알고리즘 때 많이 사용
const currentStr8 = str1.match(/e/g); //'e', 'e', 'e', 'e'
728x90
'javascript' 카테고리의 다른 글
함수 유형 (3) | 2022.08.22 |
---|---|
charAt () (3) | 2022.08.22 |
search () (4) | 2022.08.22 |
includes (2) | 2022.08.17 |
padStart / padEnd (2) | 2022.08.17 |
댓글