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

181
Vistas
Regular expressions not working in gulp-regex-replace?

I'm trying to remove all line breaks in an HTML file using gulp-regex-replace. I'm trying the regular expressions from here. None of them work.

let replace = require('gulp-regex-replace');

gulp.task("strip", function () {
  return (
    gulp
      .src("./*.html")
      .pipe(replace({regex:/\r?\n|\r/g, replace:''}))
      .pipe(gulp.dest("./dist/"))
  );
});

I also tried /[\r\n]+/gm with no luck.

Trying other regular expressions works, but line breaks don't budge. I'm using OS X with VSCode.

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

0

I would switch to gulp-replace. gulp-regex-replace was last published 8 years ago and probably doesn't work well with gulp4.+.

I tested this with gulp-replace and it worked to remove newlines.

const replace = require('gulp-replace');

gulp.task("strip", function () {
  return (
    gulp
      .src("./*.html")
      .pipe(replace(/\r?\n/g, ''))       // simpler syntax too
      .pipe(gulp.dest("dist"))           // this is probably enough for you
  );
});
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