Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: position of first matching regex

by AnomalousMonk (Archbishop)
on May 17, 2014 at 17:35 UTC ( [id://1086454]=note: print w/replies, xml ) Need Help??


in reply to Re^2: position of first matching regex
in thread position of first matching regex

... $-[0] requires /...(...).../ re positional variables.

You show a capturing group in your example and refer to "positional variables", so I thought I'd mention that  $-[0] is the offset of the start of the overall match and does not depend at all on capture groups.

c:\@Work\Perl>perl -wMstrict -le "my $s = 'xxxabcyyy'; ;; print qq{overall match begining at offset $-[0] in '$s'} if $s =~ m{ abc }xms; " overall match begining at offset 3 in 'xxxabcyyy'

(And BTW: I've been practicing goofs for quite a while myself.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1086454]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-04-25 15:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found