Mike,

> I have a problem with a rule on a newly installed relay on which --lint
> throws a warning on an old local rule, squawking about "Variable length
> lookbehind  not implemented". I simplified the rule trying to discover
> the problem and it seems to be with the /i modifier:
> 
> This rule does _not_ provoke the warning:
> 
>   /(?<!Best )\bRegards,/
> 
> while this does,
> 
>   /(?<!Best )\bRegards,/i
> 
>   warn: config: invalid regexp for rule MY_CLOSE:
>   /(?<!Best )\bRegards,/i: Variable length lookbehind not implemented
>   in regex m/(?i)(?<!Best )\bRegards,/
> 
> This is with perl 5.18.1 (openSUSE 13.1)
> 
> On other boxes  - with perl 5.10.0 and perl 5.16.2 - there is no problem
> and I fail to see that there is any variable length in either regex.
> 
> Writing the rule like so with an apparently useless /i modifier allows
> the regex to pass the lint check:
> 
>   /(?<![Bb][Ee][Ss][Tt] )\b[Rr][Ee][Gg][Aa][Rr][Dd][Ss],/i
> 
> Can somebody tell me what the problem might be?

The 'st' is apparently equivalent to some ligature or some other UTF-8
character, so you end up with an alternation of two different lengths,
which can't be used for look-behinds.

Use a character set modifier /a to restrict the matching to ASCII rules.
Search for "Character set modifiers" in the perlre man page.

So something like:
  /(?<!Best )\bRegards,/aai
should do with perl >= 5.14 .

Better yet, avoid lookbehinds.

  Mark

Reply via email to