MplusAutomation icon indicating copy to clipboard operation
MplusAutomation copied to clipboard

^metacharacter for PCRE in filefilter does not work as intended.

Open AlexandreGareau opened this issue 1 year ago • 0 comments

I wish to use filefilter regex to select only the .out that starts by a numeric character. I tried this ^[0-9] but it does not work.

I realized that the filefilter argument might not be accepting ^ as a metacharacter because that in getOutFileList() there is a grep() function that already implements some baseline PCRE code for the filter. Therefore .* is already put at the begining of any filefilter. The ^ metacharacter for specifying to look for the first character does not work.

outfiles <- outfiles[grep(paste(".*", filefilter, ".*", sep = ""), dropOutExtensions, ignore.case = TRUE, perl = TRUE)]

Well that is what I think the problem is but then I tested the regex here regex test It should works but I receive this error

Warning message: In getOutFileList(target, recursive, filefilter) : No output files detected in this directory. If a take the ^ out of the regex. The readModels() function works, but the filefilter includes output that have a number other than the first character.

AlexandreGareau avatar Oct 19 '23 15:10 AlexandreGareau