Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: index regex

by AnomalousMonk (Canon)
on Jun 08, 2013 at 11:13 UTC ( #1037840=note: print w/replies, xml ) Need Help??


in reply to Re: index regex
in thread index regex

If 5.10+ is available, use of the  //p regex modifier allows  ${^MATCH} (and friends) to be used eliminating the need for an explicit capture and perhaps slightly speeding the matching:

>perl -wMstrict -lE "my $line = q{as specified, line has: no digits (0-9); letters!}; ;; say qq{'${^MATCH}' found at $-[0]} while $line =~ m{ [ (),.;:?!-] }xmsgp; " ' ' found at 2 ',' found at 12 ' ' found at 13 ' ' found at 18 ':' found at 22 ' ' found at 23 ' ' found at 26 ' ' found at 33 '(' found at 34 '-' found at 36 ')' found at 38 ';' found at 39 ' ' found at 40 '!' found at 48

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1037840]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-06-26 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (578 votes). Check out past polls.