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

Re^3: Grep Pattern

by rsFalse (Hermit)
on Dec 15, 2018 at 20:43 UTC ( #1227305=note: print w/replies, xml ) Need Help??


in reply to Re^2: Grep Pattern
in thread Grep Pattern

Here I reset 'pos' when match approaches the end of the pattern, allowing second regex always match:
#!/usr/bin/perl # https://perlmonks.org/?node_id=1227147 use warnings; use strict; my $pattern = 'FTTF'; my @result = grep { $pattern =~ /(?!$)/g; $pattern =~ /./g; $& eq 'T' } 0 .. 12; print "@result\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2020-11-25 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?