Let's say I have several URLs and I return the basename from each URL, like so;
http://www.test.com/the.code.r00
would return
the.code.r00
and I have several basenames I extracted from several URLs to work on
the.code.r00
the.code.r01
..
...
the.code.r12
and together with those I have the following basenames too from other URLs
the.matrix.r00
the.matrix.r01
..
...
the.matrix.r14
I'd like to know if there's a known algorithm which has been tested and proven to return
the.code.r
the.matrix.r
after parsing the basenames I listed above.
Also, if instead, there is some *nix tool which does the same thing that would be super.
Note, the format isn't always like above, otherwise I could have done a simple substr. The numbers aren't always listed at some specific location in the string. Some other examples;
the.code.part01.rar
the.code.001
..
....
I could implement my own algorithm to do this but it would probably be a can of bugs without some heavy testing so I'd prefer to use a known algorithm if there is one already defined..