In this sentence, /comprar/volkswagen/gol/11184529
, I would like to capture if there is the word comprar
what comes next without the /
, that is, I would like to capture the word volkswagen
(but could be another
In this sentence, /comprar/volkswagen/gol/11184529
, I would like to capture if there is the word comprar
what comes next without the /
, that is, I would like to capture the word volkswagen
(but could be another
Regex ^\/comprar\/([^\/]+)\/([^\/]+)\/\d+$
. Then get the first and second group.
Take ^
and $
if it is not just one occurrence per line.