in reply to regex issue (positive look-ahead)

The difference between the two regexes is the placement of your $ metacharacter, so that should be your red flag. By moving it you are changing your trailing anchor. The first version says:
  1. Match at least one character that is not a slash
  2. It should be followed by (non-consuming):
    1. a slash
    2. the end of string

The new version says:

  1. Match at least one character that is not a slash
  2. It should be followed by (non-consuming):
    1. a slash
  3. The last consumed element should be followed by the end of string

In your second regex, the positive look-ahead assertion and the end of string anchor directly conflict. Obligatory documentation refs: perlre, perlretut.