TRegexp::MakeWildcard does not process ‘?’ as I would have expected. I expected ‘?’ to be treated as a wildcard for any single character, as this is the use case in most shells. Instead it is ignored and left to interpretation in the sense of regular expressions. Attached is a diff between the current TRegexp.cxx and one handling ‘?’ as I suggest to demonstrate my meaning.
If this is not an oversight then the word ‘wildcard’ was misleading to me. Of course, modifying TRegexp::MakeWildcard to accommodate this feature breaks any code currently using TRegexp with wildcard=kTRUE and using ‘?’ in the sense of regular expressions, but I am just curious to know if this is intentional.
TRegexp.cxx.diff.txt (385 Bytes)
I’ve now consider also the ? as a wildcard char. Check out the cvs head and let me know if it works for you.
The ‘?’ is still not handled in the manner of most shells. A ‘?’ is a wildcard for any single character and requires that there BE a character. In the latest revision the single character is still optional because the ‘?’ is appended to the char* (and so treats the preceding character in the sense of regular expressions).
For example, if I have three files named ‘file’, ‘file1’ and ‘file2’, then in most shells
will list all three files, but
will only list ‘file1’ and ‘file2’. Maybe I am being too much of a stickler about this, but again the term ‘wildcard’ is misleading to me if it does not treat ‘?’ in the above sense. Thanks for looking into this!
Sorry, fix should be ok now. Please try.