Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 surveying the Monastery: (16)
As of 2015-07-30 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls