|Perl Monk, Perl Meditation|
Re^2: A regex that only matches at offset that are multiples of a given N?by BrowserUk (Pope)
|on Feb 16, 2013 at 07:21 UTC||Need Help??|
First, I'm not the right person to be asking this question of. Whatever regex expertise I once had is well out of date. There is a whole bunch of stuff I've never done anyting with. However, this is my interpretation of the decidedly unclear documentation:
The (what appears to be called) zero-length switch assertion, appears to succeed, whenever the condition part succeeds; regardless of whether the yes pattern (or no pattern, if present) succeed.
So with 6 characters in your string, and a condition that restricts matching to every second character, the overall match succeeds 3 times, even if the yes pattern only matches at 2 of those positions. Hence your output.
Also, I notice the x modifier doesn't work with a conditional pattern:
It appears that you are breaking up an indivisible token with the whitespace you've used. This works:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.