On 2013-07-31, Paul Johnson <paul@pjcj.net> wrote: > > I think this is one of those "it's a feature, not a bug" moments. > Though I'll admit that in over 20 years of using Perl, it's a feature > I've never made use of. > > From perlop: > > The empty pattern // > If the PATTERN evaluates to the empty string, the last > successfully matched regular expression is used instead. In this > case, only the "g" and "c" flags on the empty pattern are honored; > the other flags are taken from the original pattern. If no match > has previously succeeded, this will (silently) act instead as a > genuine empty pattern (which will always match). > I see. Then it's a feature. Never mind. Just if you want to know my use case, the second match uses a regular expression specified by an user. And user could assume that an empty expression matches any string. -- PetrThread Previous | Thread Next