regex javascript match left substring code example
Example 1: js match any number string
const match = 'some/path/123'.match(/\/(\d+)/)
const id = match[1] // '123'
Example 2: regular expression javascript
// Tests website Regular Expression against document.location (current page url)
if (/^https\:\/\/example\.com\/$/.exec(document.location)){
console.log("Look mam, I can regex!");
}