「exec」で最初に一致した文字列を抽出 パターンに「g」フラグを適用しているにも関わらず、最初に一致した文字列しか抽出していない点がexecの特徴になります。 返り値として配列データを受け取り、0番目の要素にパターンと一致した文字列を取得する ...
The exec() method of {{jsxref("RegExp")}} instances executes a search with this regular expression for a match in a specified string and returns a result array, or null. If the match succeeds, the ...