You're almost there!
Simply use:
(?<=prodotti\/).*?(?=\/)
instead of:
(?<=prodotti\/).*(?<=\/)
And you're good ;)
See it working here on regex101.
I've actually just changed two things:
- replaced that lookbehind of yours (
(?<=\/)
) by its matching lookahead... so it asserts that we can match a /
AFTER the last character consumed by .*
.
- changed the
greediness
of your matching pattern, by using .*?
instead of .*
. Without that change, in case of an url that has several /
following prodotti/
, you wouldn't have stopped to the first one.
i.e., given the input string: http://www.demo.it/prodotti/822/Panasonic/TXP46G20E.html
, it would have matched 822/Panasonic
.