「if」は私にもっと答えを与えます..最初だけを得る方法は? ありがとう。 http://jsfiddle.net/TsxBy/
var content = "var=xyz-id=2,var=abc-id=1,var=bcd-id=7,var=abc-id=1,var=hij-id=4,var=xyz-id=2";
content = content.split(',');
for (i = 0; i < content.length; i++) {
var temp = content[i].match(/\d/);
if (temp == '1') {
alert('match 1'); // how to response only first "matched"?
}
if (temp == '2') {
alert('match 2'); // same here
}
}