Short explanation: (?{...}) means to execute arbitrary Perl code inside a regular expression, and (?!) makes the regex engine to fail and backtrack, trying to match from the last_pos + 1. When it starts matching ABC, it prints it, fails, backtracks and starts matching from B the next three letters, giving us BCD. The process repeats until the internal regex counter reaches the end of the string.
I know, I'm really bad at explaining things to humans, but, fortunately, Athanasius explained this better once.
Please see: Re: RegEx + vs. {1,}
In reply to Re^3: substitution in regular expression
by trizen
in thread substitution in regular expression
by aeqr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |