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

116
Vistas
perl lookbehind bug?
use v5.34;
$_ = "#    name = 'epii1/tagbar-markdown'";
if(/name(?<!#\s{0,20})\s*=\s*'.*'/) {
  print "$_\n";
}

I want to match strings which contain name = '.*' and are not commented. For example, name = 'tpope/vim-scriptease' should be matched, and # name = 'epii1/tagbar-markdown' should not. I use a negative zero-width assertion, not positive. I know the right pattern should be (?<!#\s{0,20})name\s*=\s*'.*'. I just want to have a try and I think the pattern in the code block is wrong, and the given string would be matched. However, nothing is printed (except the warning about variable length lookbehind), so perl judges it is not matched. Then I write in javascript:

let text = "#    name = 'epii1/tagbar-markdown'";
let pattern = /name(?<!#\s{0,20})\s*=\s*'.*'/;
let result = pattern.test(text);
console.log(result);

result gives true. So is this a bug of perl?

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