Re: [PATCH v5 1/1] send-email: Add sendmail email aliases format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 26, 2015 at 4:53 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Tue, May 26, 2015 at 3:41 PM, Allen Hubbe <allenbh@xxxxxxxxx> wrote:
>> On Tue, May 26, 2015 at 3:10 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>>> On Saturday, May 23, 2015, Allen Hubbe <allenbh@xxxxxxxxx> wrote:
>>>> +               # recognize lines that look like an alias
>>>> +               elsif (/^(\S+)\s*:\s*(.+?)$/) {
>>>
>>> Observation: Given "foo:bar:baz", this regex will take "foo:bar" as
>>> the key, and "baz" as the value, which is probably not what was
>>> intended, however, it likely doesn't matter much in this case since
>>> colon isn't legal in an email address[1].
>>
>> That's a keen observation.  I think it would work simply to use a
>> non-greedy +? in the first capture group.
>
> Yes, that would work. Alternately: /^([^\s:]+)\s*:\s*(.+?)$/

I will use the non-greedy +? because the resulting expression is easier to read.

I will remove the non-greedy +? from the second capture group.  It
serves no purpose there any more.  It had been there to allow matching
a trailing backslash after the group, but now lines with trailing
backslash are ignored entirely before reaching here.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]