So extrahieren Sie dynamische Variable aus <> Klammer in JavaScript

let pattern = "/used-cars/<city_name>/<location>/<car_name>-cars-for-sale"
let matches = pattern.match(/<.+?>/g);
const newArray = matches.map((match) => match.replace(/[<>]/g, ''));
let object = {};
newArray.map((item, index) => {
  object[item] = '';
});
console.log(object)
Frightened Fish