Moving servers

Florian Schlichting fschlich at CIS.FU-Berlin.DE
Fri Mar 4 11:15:57 UTC 2011


Hi Julien,

> >BTW inncheck doesn't catch this kind of error. Small improvement:
> >
> >-       unless ( ($name, $pass) = /[\w\-\.]+:(.*):(.*)(:authinfo)?$/ ) {
> >+       unless ( ($name, $pass) = /[\w\-\.]+:([^:]*):([^:]*)(:authinfo)?$/ ) {
> 
> Or /[\w\-\.]+:(.*?):(.*?)(:authinfo)?$/ for ungreedy matching.
> I have always wondered what is the most readable.  Maybe your
> [^:]* is the preferred way to write it in Perl.

In this case, ungreedy matching is not enough, as :authinfo is optional
thus any amount of trailing garbage would just be forced into the
previous capture.

Ungreedy matching with .*? is not used very often, and even though I had
used it myself before I had forgotten about it and was confused when I
stumbled over it just two days ago... I think in general, the "ungreedy"
effect is not very obvious in its consequences, whereas [^:]* obviously
stands for "anything but a colon", and so should be preferred.

Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5557 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/inn-workers/attachments/20110304/4af80733/attachment.bin>


More information about the inn-workers mailing list