Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: A regex that only matches at offset that are multiples of a given N?

by smls (Friar)
on Feb 13, 2013 at 23:35 UTC ( #1018660=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #      0    5   10   15   20   25   30   35
    #      '    '    '    '    '    '    '    '
    $_ = q{.....fred1..fred2...fred3....fred4..};
    ...
        say "  matched 'fred$1' at pos @{[pos($_)-$n]} (gobbled '$&')";
      }
    }
    
  2. or download this
    $n = 4
      matched 'fred2...' at pos 12 (gobbled '.....fred1..fred')
    ...
    $n = 5
      matched 'fred1..' at pos 5 (gobbled '.....fred1')
      matched 'fred3....' at pos 20 (gobbled '..fred2...fred3')
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2014-09-23 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls