티스토리 뷰
(?:...) 캡쳐를 하지 않는다.
var st = "bug bug's and bug bugs";
st.match(/bug(?='s)/g);
["bug"]
(?=...) 일치하는 문자의 캡처를 제외한다.
(?!...) 캡체를 제외한 모든 문자를 찿는다.
bug bug's and bug bugs .match(/ bug(?!'s) /g );
["bug","bug","bug"]
[^...] /[^c-u]/ c - u 사이를 제외한 다른 문자열 선택
abcdefghijklmnopqrstuvwxyz 0123456789
Stop, don't go that way! If you do, and you shouldn't btw, you might die. Hey, thats life.match( /\b\w+(?=,)\b/g );
["Stop","do","btw","Hey"]
Stop, don't go that way! If you do, and you shouldn't btw, you might die. Hey, thats life.
Stop, don't go that way! If you do, and you shouldn't btw, you might die. Hey, thats life.match( /\b\w+(?!,)\b/g );
Stop, don't go that way! If you do, and you shouldn't btw, you might die. Hey, thats life.
apples to apples.match( / (apples) to \1 /g );
apples to apples