given this string " - '/168-market'" write a regex expression to match "/168-market" in typescript

You can use the match method in Typescript with the following regex expression to match /168-market in the given string:

index.ts
const str = "  - '/168-market'";
const regex = /\/\d+-\w+/;
const match = str.match(regex);

console.log(match); // Output: ["/168-market"]
140 chars
6 lines

In the above example, the regular expression /\/\d+-\w+/ matches any sequence of digits, letters, or underscore preceded by a forward slash (/). The match method returns an array containing the matching substring(s).

gistlibby LogSnag