0
Q:

js string to regex

const match = 'some/path/123'.match(/\/(\d+)/)
const id = match[1] // '123'
2
const regex = new RegExp('https:\\/\\/\\w*\\.\\w*.*', 'g');
1
// Tests website Regular Expression against document.location (current page url)
if (/^https\:\/\/example\.com\/$/.exec(document.location)){
	console.log("Look mam, I can regex!");
}
8

New to Communities?

Join the community