get first match regex javascript code example
Example 1: javascript regex for firstname
var nameRegex = /^[a-zA-Z\-]+$/;
Example 2: js match any number string
const match = 'some/path/123'.match(/\/(\d+)/)
const id = match[1] // '123'
var nameRegex = /^[a-zA-Z\-]+$/;
const match = 'some/path/123'.match(/\/(\d+)/)
const id = match[1] // '123'