Please visit and sign this petition:
International Campaign for reconstruction of Buddha's Statues, in Bamiyan
http://www.thepetitionsite.com/38/international-campaign-for-reconstruction-of-buddhas-statues-in-bamiyan/
________________________________
From: Conor <conor.l...@gmail.com>
To: gai...@visioninfosoft.com
Cc: perl-win32-users@listserv.activestate.com
Sent: Thursday, April 14, 2011 2:08 PM
Subject: Re: can a regex pattern match return the starting position of the
match?
Greg-
This question was answered on Stack
Overflow: http://stackoverflow.com/questions/87380/how-can-i-find-the-location-of-a-regex-match-in-perl
brian d foy's answer seems to be the best:
The built-in variables @- and @+ hold the start and end positions,
respectively, of the last successful match. $-[0] and $+[0] correspond to
entire pattern, while $-[N] and $+[N] correspond to the $N ($1, $2, etc.)
submatches.
-Conor
On Thu, Apr 14, 2011 at 10:38 AM, Greg Aiken <gai...@visioninfosoft.com> wrote:
given how smart perl is, I was thinking there must be a
function within perl whereby if one does a pattern match against a scaler, that
in addition to having regex being able to return such built in vars as: $`
(what preceeds the match), $’ (what follows the match), $1, etc…
>
>is there a built in var that returns the position within the
scalar where the match occurred?
>
>of course, if not, one may always evaluate length($`).
>
>I was just curious
>_______________________________________________
>Perl-Win32-Users mailing list
>Perl-Win32-Users@listserv.ActiveState.com
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs