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

100
Views
Mostrar una parte de una cadena

Obtengo registros de la API en el formato que se muestra a continuación. ¿Cómo puedo mostrar la parte después de la última \n y la hora? Los dígitos son el tiempo. ¿Se puede hacer con algunos métodos de matriz o necesitaría expresiones regulares aquí?

1645549901022 Running\n1645549901022 Process started\n1645549901022 START - Cloning repo\n1645549934999 Removed dumps

La parte que quiero mostrar es solo Removed dumps

editar: \n se está ignorando, así que creo que tendría que hacer coincidir los últimos dígitos/tiempo

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

0

Una línea:

 const input = '1645549901022 Running\n1645549901022 Process started\n1645549901022 START - Cloning repo\n1645549934999 Removed dumps'; const output = input.split(/[\n(\d+)]+/); console.log(output[output.length-1].trim());

Resultado: Removed dumps

about 4 years ago · Juan Pablo Isaza Report

0

Esto es un ejemplo:

 <script> logString = "1645549901022 Running\n1645549901022 Process started\n1645549901022 START - Cloning repo\n1645549934999 Removed dumps"; arr = logString.split(" "); text = arr[arr.length-1] + ' ' + arr[arr.length-2]; alert(text); </script>
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!