Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Grep Pattern

by rsFalse (Friar)
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 scrutinizing the Monastery: (10)
As of 2019-11-18 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (90 votes). Check out past polls.

    Notices?