문자열에서 특정 문자 조합을 찾기 위한 패턴
/pattern/flag
/b[a,e,i]g/i -> bag, beg, big 이라는 단어를 대소문자 구분하지 않고 찾는다
g(global) : 모든 문자를 검색(배열로 반환)
i(ignoreCase) : 영어 대소문자를 구분하지 않는 조건
m(multi line) : 문자열의 행이 바뀌어도 패턴 검색을 계속하는 조건
y(sticky) : 생성된 정규 표현식 인스턴스에서 lastIndex라는 속성 사용
-> g와 함께 사용할 경우 g를 무시
const str = "sticky sticky"
const regExp = /i/y;
regExp.lastIndex = 9;
srt.match(regExp);
// ["i", index: 9, input: "sticky sticky", ...
u(unicode) : 유니코드 문자 처리
const mood = 'have a good day🙂';
const regExp = /[\u{1F600}-\u{1F64F}]/gu;
//['🙂']
https://velog.io/@jeongda/%EC%A0%95
위 주소에서 @뒤에오는 블로그명 추출하기const url = "https://velog.io/@jeongda/%EC%A0%95" url.match(/(?<=\@).*(?=\/)/)[0]; // 'jeongda'
http://www.tcpschool.com/php/php_regularExpression_basic
https://hamait.tistory.com/342
https://hanamon.kr/javascript-%EC%A0%95%EA%B7%9C%ED%91%9C%ED%98%84%EC%8B%9D-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-%EA%B0%9C%EB%85%90%ED%8E%B8/