How to extract dynamic variable from <> bracket 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)