EasyRegex Logo
EasyRegex
Nouveau

Match a Number in JavaScript

javascript

Expression Régulière

\d+
Copier
Avez-vous des Retours ?

Explication

This regex pattern \d+ will match any sequence of one or more digits (0-9).

javascript

Exemple d'Utilisation

const pattern = /\d+/g;
const testString = 'The number is 42';
const numbers = testString.match(pattern);
console.log(numbers);
Copier
Testez l'expression

Expressions Régulières Similaires