Hi,

I need to select a substring from the filename of a file in a list.
I can find all the filenames in a directory by

list.files(fn_dir)

Each filename has the format (the following is an example because field
lengths are variable)

XXX184_YYY_ZZZ.dat

XXX: 2 or 3 alphabetic characters
184: 3 numeric characters
...

I'd like to select the substring XXX which has variable length (from each
filename). I saw regular expressions help but still I can't figure out how
to do.


Thanks,
Arnaud Chozo

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to