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'

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools