1 |
On 2019-01-23, Alexander Kapshuk <alexander.kapshuk@×××××.com> wrote: |
2 |
> On Wed, Jan 23, 2019 at 9:41 PM Grant Edwards <grant.b.edwards@×××××.com> wrote: |
3 |
>> On 2019-01-23, Alexander Kapshuk <alexander.kapshuk@×××××.com> wrote: |
4 |
>> |
5 |
>> > This any better? :-) |
6 |
>> > |
7 |
>> > echo '198.088.0.01 |
8 |
>> > 198.088.062.01 |
9 |
>> > 198.088.0.001' | sed -r 's/\.0+([^.0]+)/.\1/g' |
10 |
>> |
11 |
>> I guess it's 'better', but it's still broken: |
12 |
>> |
13 |
>> $ echo '003.4.5.6' | sed -r 's/\.0+([^.0]+)/.\1/g' |
14 |
>> 003.4.5.6 |
15 |
>> |
16 |
>> This is not a good application for a regex. |
17 |
> |
18 |
> The OP stated that there were no leading zeros in the first octet of |
19 |
> the IP address, so that case did not need to be handled. |
20 |
|
21 |
If I had a dollar for every bug/failure that happened because somebody |
22 |
relied on an input restriction like that... |
23 |
|
24 |
-- |
25 |
Grant Edwards grant.b.edwards Yow! You mean you don't |
26 |
at want to watch WRESTLING |
27 |
gmail.com from ATLANTA? |