를 사용 http://jsfiddle.net/aEEUN/정규식 : 나는 더 backrefences 대 역 참조를 사용할 때, 나는 다른 결과를 얻을 왜 다른 결과를 역 참조
를 참조하십시오?
var str = "Hello World\nHello ";
document.write("Without backreference: <br />");
var match = str.match(/\S(?![\s\S]*\S)/);
document.write("- match.index: " + match.index + "<br />"); // index is 16
document.write("With backreference: <br />");
var match = str.match(/(\S)(?![\s\S]*\1)/);
document.write("- match.index: " + match.index); // index is 6