Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
javascript: obtener números después de la entrada en la cadena

Tengo un texto y quiero buscar en el texto, encontrar la palabra y luego devolver los números después de esta palabra

por ejemplo :

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

quiero encontrar entrada y retorno 2430

¿Cómo puedo manejar esto?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Simplemente use una expresión regular simple:

 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 Report

0

Si lo quieres en 1 línea:

 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 Report

0

También puedes hacerlo con indexOf y expresión regular.

 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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!