perl-5.38.0
@LAST_MATCH_START
@-

This array holds the offsets of the beginnings of the last successful match and any capture buffers it contains. (See "Scoping Rules of Regex Variables").

この配列は、最後に成功したマッチングの先頭へのオフセットと、 パターンが含むすべてのマッチング捕捉バッファを保持します。 ("Scoping Rules of Regex Variables" を参照してください。)

The number of elements it contains will be one more than the number of the highest capture buffers (also called a subgroup) that actually matched something. (As opposed to @+ which may have fewer elements.)

The number of elements it contains will be one more than the number of the highest capture buffers (also called a subgroup) that actually matched something. (As opposed to @+ which may have fewer elements.) (TBT)

$-[0] is the offset of the start of the last successful match. $-[n] is the offset of the start of the substring matched by n-th subpattern, or undef if the subpattern did not match.

$-[0] は最後に成功したマッチの先頭のオフセットです。 $-[n]n 番目のサブパターンにマッチした部分文字列の先頭の オフセットです; サブパターンがマッチしなかった場合は undef です。

Thus, after a match against $_, $& coincides with substr $_, $-[0], $+[0] - $-[0]. Similarly, $n coincides with substr $_, $-[n], $+[n] - $-[n] if $-[n] is defined, and $+ coincides with substr $_, $-[$#-], $+[$#-] - $-[$#-]. One can use $#- to find the last matched subgroup in the last successful match. Contrast with $#+, the number of subgroups in the regular expression.

従って $_ のマッチの後、$nsubstr $_, $-[0], $+[0] - $-[0] と一致します。 同様に、$n は、$-[n] が定義されていれば substr $_, $-[n], $+[n] - $-[n] と一致し、 $+substr $_, $-[$#-], $+[$#-] - $-[$#-] と一致します。 $#- は直前に成功したマッチで最後のマッチしたサブグループを 探すのに使えます。 正規表現でのサブグループの数である $#+ と対照的です。

$-[0] is the offset into the string of the beginning of the entire match. The nth element of this array holds the offset of the nth submatch, so $-[1] is the offset where $1 begins, $-[2] the offset where $2 begins, and so on.

$-[0] はマッチ全体の先頭の文字列へのオフセットです。 この配列の n 番目の要素は n 番目のサブマッチへの オフセットを保持しますので、$-[1]$1 の先頭への オフセット、$-[2]$2 の先頭へのオフセット、などとなります。

After a match against some variable $var:

ある変数 $var でマッチした後、以下のようになります。

$` is the same as substr($var, 0, $-[0])

($`substr($var, 0, $-[0]) と同じです)

$& is the same as substr($var, $-[0], $+[0] - $-[0])

($&substr($var, $-[0], $+[0] - $-[0]) と同じです)

$' is the same as substr($var, $+[0])

($'substr($var, $+[0]) と同じです)

$1 is the same as substr($var, $-[1], $+[1] - $-[1])

($1substr($var, $-[1], $+[1] - $-[1]) と同じです)

$2 is the same as substr($var, $-[2], $+[2] - $-[2])

($2substr($var, $-[2], $+[2] - $-[2]) と同じです)

$3 is the same as substr($var, $-[3], $+[3] - $-[3])

($3substr $var, $-[3], $+[3] - $-[3]) と同じです)

This variable is read-only, and its value is dynamically scoped.

この変数は読み込み専用で、その値は動的スコープを持ちます。

This variable was added in Perl v5.6.0.

この変数は Perl v5.6.0 で追加されました。