in reply to Re: Lookahead assertion
in thread Lookahead assertion
When the engine sees that it should try again because of the /g, it steps one character past where last it tried.This explains why the final . in BrowserUk’s solution is not strictly necessary
Indeed. The final '.' is not necessary with Perl's regex engine.
But many other regex libraries -- including some that claim to be Perl-compatible -- do not have this pragmatic deviation from the classical regular expression operation; hence it has become a habit with me to do this explicitly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Lookahead assertion
by talexb (Chancellor) on Oct 17, 2013 at 11:39 UTC |