http://www.perlmonks.org?node_id=1018796


in reply to Re^3: A regex that only matches at offset that are multiples of a given N?
in thread A regex that only matches at offset that are multiples of a given N?

Ah yes, you need to add parenthesis after the pos (to make sure it is interpreted as a function without parameters):

/fred(?(?{ pos() % 4 != 0 })(?!))(....)/sg

I fixed that locally while testing ikegami's regex but then forgot about it when reporting back, sorry.

  • Comment on Re^4: A regex that only matches at offset that are multiples of a given N?