js regex on string code example
Example 1: js match any number string
const match = 'some/path/123'.match(/\/(\d+)/)
const id = match[1] // '123'
Example 2: javascript regex match character from a set of characters
// Regex - Any character from a set of characters
console.log(/[0123456789]/.test("in 1992")); // true
console.log(/[0-9]/.test("in 1992")); // true
console.log(/[abc]/.test("def")); // false
console.log(/[abc]/.test("cdef")); // true