Are there any good resources for detailed string matching equations?
What I need to do is go through files in a directory. The files that I need to pull out contain:
following a "/"
Any sequence of characters followed by an underscore followed by any sequence of characters, followed by an underscore, etc. It's not always the same size sequences of characters and not the same amount of sequences of characters.
After the final underscore there is a sequence of 4, 13, or 14 numbers in which I need to obtain the first 4.
Following these numbers I have the suffix of the file (.xxx)
so for instance, some possible file names could be:
/cit_stat_pol_2849.dat
/xo_tnn_58494957712553.suf
/map_addr_0039.suf
in the above examples I would like to pull out and set into variables:
1: "cit_stat_pol_", "2849", "dat"
2: "xo_tnn_", "5849", "suf"
3: "map_addr_", "0039", "suf"
If you can think of a formula for that could you please help me, or at least provide me with a resource with detailed instructions on how to do some of the things I will need to do?
Thanks!
What I need to do is go through files in a directory. The files that I need to pull out contain:
following a "/"
Any sequence of characters followed by an underscore followed by any sequence of characters, followed by an underscore, etc. It's not always the same size sequences of characters and not the same amount of sequences of characters.
After the final underscore there is a sequence of 4, 13, or 14 numbers in which I need to obtain the first 4.
Following these numbers I have the suffix of the file (.xxx)
so for instance, some possible file names could be:
/cit_stat_pol_2849.dat
/xo_tnn_58494957712553.suf
/map_addr_0039.suf
in the above examples I would like to pull out and set into variables:
1: "cit_stat_pol_", "2849", "dat"
2: "xo_tnn_", "5849", "suf"
3: "map_addr_", "0039", "suf"
If you can think of a formula for that could you please help me, or at least provide me with a resource with detailed instructions on how to do some of the things I will need to do?
Thanks!