サブパターンを取得できないのはなぜですか? undefined
出力が期待されるときにコンソールが表示されhello
ます。に変更matches[1]
するmatches[0]
と、 が得られ{{hello}}
ます。では、なぜサブパターンにアクセスできないのでしょうか?
var str = "{{hello}}";
var matches = str.match(/{{(.+)}}/ig);
console.log(matches[1]);
サブパターンを取得できないのはなぜですか? undefined
出力が期待されるときにコンソールが表示されhello
ます。に変更matches[1]
するmatches[0]
と、 が得られ{{hello}}
ます。では、なぜサブパターンにアクセスできないのでしょうか?
var str = "{{hello}}";
var matches = str.match(/{{(.+)}}/ig);
console.log(matches[1]);