how to extract dynamic variable from 3c 3e bracket in javascript

Solutions on MaxInterview for how to extract dynamic variable from 3c 3e bracket in javascript by the best coders in the world

showing results for - "how to extract dynamic variable from 3c 3e bracket in javascript"
Leonie
20 Oct 2020
1let pattern = "/used-cars/<city_name>/<location>/<car_name>-cars-for-sale"
2let matches = pattern.match(/<.+?>/g);
3const newArray = matches.map((match) => match.replace(/[<>]/g, ''));
4let object = {};
5newArray.map((item, index) => {
6  object[item] = '';
7});
8console.log(object)
9
similar questions