# Find all runs in a string containing only numbers

The documentation has the following example to find all runs in a string containing only "a" and "b":

StringCases["aababbcccdbaa", ("a" | "b") ..]
{"aababb", "baa"}


I would like to find all runs in a string containing only numbers. E.g.,

findnumbers["DataSummary_1N_5M_10L.dat"]
{"1", "5", "10"}


What is the nice way to do this, besides just writing out explicitly in the second argument of StringCases ("1" | "2" | "3" | "4" |...etc... ) ..? Thanks!

• check DigitCharacter or NumberString. – Kuba Aug 10 '17 at 19:44
• at least closely related: 8938 – Kuba Aug 10 '17 at 19:46
• Thanks! This is exactly what I was looking for. – Diffycue Aug 10 '17 at 19:46
• Also related: (73172) – Mr.Wizard Aug 11 '17 at 2:14

data = "DataSummary_1N_5M_10L.dat";

• StringCases[str, DigitCharacter ..] should also work. – J. M.'s discontentment Aug 10 '17 at 19:49