Index: /trunk/Mars/mbase/MDirIter.cc
===================================================================
--- /trunk/Mars/mbase/MDirIter.cc	(revision 13077)
+++ /trunk/Mars/mbase/MDirIter.cc	(revision 13078)
@@ -63,4 +63,5 @@
 #include "MDirIter.h"
 
+#include <fstream>
 #include <iostream>
 
@@ -68,5 +69,9 @@
 #include <TNamed.h>
 #include <TRegexp.h>
+#include <TPRegexp.h>
 #include <TSystem.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
 
 ClassImp(MDirIter);
@@ -171,4 +176,41 @@
 }
 
+Int_t MDirIter::ReadList(const char *name)
+{
+    TString fname(name);
+    gSystem->ExpandPathName(fname);
+
+    ifstream fin(fname);
+    if (!fin)
+    {
+        gLog << err << "Cannot open file " << fname << ": ";
+        gLog << strerror(errno) << " [errno=" << errno << "]" <<endl;
+        return -1;
+    }
+
+    Int_t rc = 0;
+
+    while (1)
+    {
+        TString line;
+        line.ReadLine(fin);
+        if (!fin)
+            break;
+
+        line = line.Strip(TString::kBoth);
+        if (line[0]=='#' || line.IsNull())
+            continue;
+
+        TObjArray &arr = *line.Tokenize(' ');
+
+        for (int i=1; i<arr.GetEntries(); i++)
+            rc += AddDirectory(arr[0]->GetName(), arr[i]->GetName(), -1);
+
+        delete &arr;
+    }
+
+    return true;
+}
+
 // --------------------------------------------------------------------------
 //
@@ -211,4 +253,11 @@
 
 // --------------------------------------------------------------------------
+//
+// Check whether the given name n matches the filter f.
+//
+// If the filter is encapsulated in ^ and $ it is assumed to be
+// a valid regular expression and TPRegexp is used for filtering.
+//
+// In other cases TRegex is used:
 //
 // As the filter string may contain a + character, we have to replace
@@ -220,5 +269,4 @@
 //   +  by  \\+
 //   *  by  [^\\/:]*
-//   ?  by  .
 //
 // And surround the filter by ^ and $.
@@ -227,24 +275,23 @@
 //  TRegexp::MakeWildcard
 //
-const TRegexp MDirIter::MakeRegexp(TString n) const
-{
-    n.Prepend("^");
-    n.ReplaceAll(".", "\\.");
-    n.ReplaceAll("+", "\\+");
-    n.ReplaceAll("*", "[^\\/:]*");
-    n.Append("$");
-
-    return TRegexp(n, kFALSE);
-}
-
-// --------------------------------------------------------------------------
-//
-// Check whether the given name n matches the filter f.
-// Filters are of the form TRegexp(f, kTRUE)
-//
-Bool_t MDirIter::MatchFilter(const TString &n, const TString &f) const
-{
-
-    return f.IsNull() || !n(MakeRegexp(f)).IsNull();
+Bool_t MDirIter::MatchFilter(const TString &n, TString f) const
+{
+    if (f.IsNull())
+        return kTRUE;
+
+    if (f[0]=='^' && f[f.Length()-1]=='$')
+    {
+        TPRegexp regex(f);
+        return !n(regex).IsNull();
+    }
+
+    f.Prepend("^");
+    f.ReplaceAll(".", "\\.");
+    f.ReplaceAll("+", "\\+");
+    f.ReplaceAll("*", "[^\\/:]*");
+    //f.ReplaceAll("?", "[^\\/:]?");
+    f.Append("$");
+
+    return !n(TRegexp(f)).IsNull();
 }
 
Index: /trunk/Mars/mbase/MDirIter.h
===================================================================
--- /trunk/Mars/mbase/MDirIter.h	(revision 13077)
+++ /trunk/Mars/mbase/MDirIter.h	(revision 13078)
@@ -20,8 +20,7 @@
     Bool_t  CheckEntry(const TString n) const;
     Int_t   IsDir(const char *dir) const;
-    Bool_t  MatchFilter(const TString &name, const TString &filter) const;
+    Bool_t  MatchFilter(const TString &name, TString filter) const;
     TString ConcatFileName(const char *dir, const char *name) const;
     void    PrintEntry(const TObject &o) const;
-    const   TRegexp MakeRegexp(TString n) const;
 
 public:
@@ -49,4 +48,5 @@
     }
 
+    Int_t ReadList(const char *fname);
     void Sort();
 
