some minor nitpicking: I'd try to replace some \s* with \s+, this one should work:
```
               /^   total               \s+  foo             \s+ \n
                    (\s*\d+(\.\d+)?k?b  \s+  \d+(\.\d+)?k?b  \s+  \n)+    $/
```

Thanks for adding this test!