> knowledge about `isPrefixOf` or `startsWith` or whatever the equivalent function is called in your language of choice.
There's no guarantee the digits are the first or last, so it's more `find` and `rfind`, unless you try every subslice of the line by hand.
Although thinking about it assuming the lines are not too long I guess that also works.