Based on command_line branch

Its mostly commit 9942b84, which has a more resilient regex that does not end in zero.