Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

320
Vistas
How to get numbers separated by any delimiter (space or any non numeric character)

How to get numbers separated by any delimiter (space or any non numeric character).

I tried Input string: "111,256 323| 78987 & 6543".split(/,| /),

but then it requires me to specify the delimiter. What Regex can I use to split the numbers and get like [111, 256, 323, 78987, 6543]

almost 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can try this :

let numberPattern = /\d+/g;
let numbersArr = "111,256 323| 78987 & 6543".match(numberPattern)
console.log(numbersArr)

The result must be like that : click here

almost 4 years ago · Santiago Trujillo Denunciar

0

To split by non numeric characters:

"111,256 323| 78987 & 6543".split(/[^\d]+/)

If you want to keep decimals:

"111,256 323| 78987 & 6543".split(/[^0-9.]+/)

If on top of that you want to get an array of numbers, map the strings to numbers:

"111,256 323| 78987 & 6543".split(/[^\d]+/).map(n => Number(n))
almost 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda