in reply to Re: Reset meaning of empty pattern?
in thread Reset meaning of empty pattern?

Thanks for testing!

I'm confused about the result you are expecting... the empty pattern would always match for every position

I want to allow users to enter any regex, I run it via eval, and it should behave "normally". The /g/ is just an example of something that my code was doing, which the user knows nothing about. So it seemed to me to be the most "normal" to have the regex behave as if it's the first regex in the program.

Replies are listed 'Best First'.
Re^3: Reset meaning of empty pattern?
by LanX (Saint) on Sep 01, 2018 at 16:57 UTC
    I'm not sure if you should even allow the empty regex.

    The result surprised me and might not be intuitive for your user.

    Unless he has to learn Perl.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Yep, I've added a warning to remind users of the special behavior of the empty pattern.