Dear R-users,
I am trying to use the grep function to test whether a particular string
is of the form "n.../mydir/myfile.mytype.myext". Anything between n and
mytype could vary, and anything after mytype could vary. I tried to
proceed by steps to build my regular expression... but I do not really
understand why the last call of the following code do not work.
Any help would be greatly appreciated.
mystr <- "n.../mydir/myfile.mytype.myext"
grep("mytype",mystr)
# returns 1
grep("[.]*mytype",mystr)
# returns 1
grep("n[.]*mytype",mystr)
# returns integer(0)
Sebastien
______________________________________________
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.