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

209
Vistas
javascript : get numbers after entry in string

I have a text and I want to search in text, find the word ,and then return the numbers after this word

for example :

this is a signal , entry : 2430 and side is short

I want to find entry and return 2430

how can I handle this?

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Just use a simple regex:

const input = 'this is a signal , entry : 2430 and side is short'; 

const number1 = input.match(/entry\W+(\d+)/)?.[1]; // "2430"

const number2 = input.match(/santa\W+(\d+)/)?.[1]; // undefined
about 4 years ago · Juan Pablo Isaza Denunciar

0

If you want it on 1 line:

text = 'this is a signal , entry : 2430 and side is short';
x = text.split('entry : ')[1].split(' ')[0]; // 2430
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can also do with indexOf and regular expression

const word = "entry";
const str = "this is a signal , entry : 2430 and side is short";

const index = str.indexOf(word);

if (index !== -1) {
  let result = str.slice(index + word.length).match(/\d+/)[0];
  console.log(result);
}

about 4 years ago · Juan Pablo Isaza 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