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

114
Views
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
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!