const myName = 'Ted Blue';
const regexName = /(\\w+) (\\w+)/;
const matchName = myName.match(regexName);
console.log(matchName);
console.log(matchName[1]);
console.log(matchName[2]);
http:// 또는 https://를 선택적으로 매치하지만 저장하지 않는 경우
const url = '<https://www.example.com>';
const regexUrl = /(?:https?:\\/\\/)?(www\\.\\w+\\.\\w+)/;
const matchUrl = url.match(regexUrl); // 일치할 경우 해당 표현식의 배열 형태로 값 반환
console.log(matchUrl);
console.log(matchUrl[1]); // www.example.com