Consider a few files with filename structure
data/Neutrino distribution functions/NAME_distribution_mass=XX.0_theta=0.YY.txt where XX/YY may have an arbitrary number of digits.
I use
files= FileNames["*.txt", FileNameJoin[{NotebookDirectory[], "data/Neutrino distribution functions/"}]]; Filenames = Table[Last@FileNameSplit@files[[i]], {i, 1, Length[files], 1}]; say,
filenames = {"Electron_distribution_mass=100.0_theta=0.009238898.txt", "Electron_distribution_mass=100.0_theta=0.01600224.txt", "Electron_distribution_mass=10.0_theta=0.5074418.txt"} Could you please tell me how to obtain the output in the form
{NAME,XX.0, 0.YY} Edit.
It seems that I have solved this problem.
This is my current attempt:
FilenameParameters[i_] := StringCases[Filenames[[i]]StringCases[filenames[[i]], mixing__ ~~ "_distribution_mass=" ~~ mass : NumberString ~~ "_theta=" ~~ angle : NumberString ~~ ".txt" :> {mixing, mass, angle}] E.g.,
FilenameParameters[1] returns
{{"Electron", "100100.0"0, "00.00715642"009238898}}