What Perl variables are used for the positions of the start and end of last successful regex match? [closed]

StackOverflow https://stackoverflow.com/questions/9933871

  •  27-05-2021
  •  | 
  •  

문제

What Perl variables are used for the positions of the start and end of last successful regex match?

도움이 되었습니까?

해결책

As the perlvar man-page explains:

$+[0] is the offset into the string of the end of the entire [last successful] match. This is the same value as what the pos function returns when called on the variable that was matched against.

$-[0] is the offset of the start of the last successful match.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top