On 2019-01-23, Alexander Kapshuk <[email protected]> wrote:
> On Wed, Jan 23, 2019 at 9:41 PM Grant Edwards <[email protected]>
> wrote:
>> On 2019-01-23, Alexander Kapshuk <[email protected]> wrote:
>>
>> > This any better? :-)
>> >
>> > echo '198.088.0.01
>> > 198.088.062.01
>> > 198.088.0.001' | sed -r 's/\.0+([^.0]+)/.\1/g'
>>
>> I guess it's 'better', but it's still broken:
>>
>> $ echo '003.4.5.6' | sed -r 's/\.0+([^.0]+)/.\1/g'
>> 003.4.5.6
>>
>> This is not a good application for a regex.
>
> The OP stated that there were no leading zeros in the first octet of
> the IP address, so that case did not need to be handled.
If I had a dollar for every bug/failure that happened because somebody
relied on an input restriction like that...
--
Grant Edwards grant.b.edwards Yow! You mean you don't
at want to watch WRESTLING
gmail.com from ATLANTA?