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

98
Vistas
Displaying a part of a string

I get logs from the api in the format shown below. How do I just display the part after the last \n and time. The digits are time. Can it be done with some array methods or would I need regex here?

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

The part that I want to display is just Removed dumps

edit: \n is getting ignored so I think I would need to match the last digits/time

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

0

One line:

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());

Result: Removed dumps

about 4 years ago · Juan Pablo Isaza Denunciar

0

This is an example:

<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 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