[tpm] problems with what regex returns ... in context ?
Shlomi Fish
shlomif at shlomifish.org
Sat May 11 01:14:27 PDT 2013
On Fri, 10 May 2013 11:23:54 -0400
Carlo Costantini <fifteen3 at gmail.com> wrote:
> Because I was following along and thought others might be following as well.
> I thought I would summarize what you discovered to help you with this
> situation.
>
> After looking up $+. I saw that there is also $& which has the string of the
> last pattern match.
>
Regarding $&, see its entry in http://perldoc.perl.org/perlvar.html :
< QUOTE >
$MATCH
$&
The string matched by the last successful pattern match (not counting any
matches hidden within a BLOCK or eval() enclosed by the current BLOCK).
The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches. To avoid this penalty,
you can extract the same substring by using @-. Starting with Perl 5.10, you
can use the /p match flag and the ${^MATCH} variable to do the same thing for
particular match operations.
This variable is read-only and dynamically-scoped.
Mnemonic: like & in some editors.
< / QUOTE >
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
List of Text Editors and IDEs - http://shlom.in/IDEs
Tel Aviv, a functional definition: free parking space‐free space.
— Shachar Shemesh ( http://blog.shemesh.biz/?p=435 )
Please reply to list if it's a mailing list post - http://shlom.in/reply .
More information about the toronto-pm
mailing list