Permalink
Browse files

Fixed a bug which caused the fail of regex matching (unwanted charact…

…ers in separator string)
  • Loading branch information...
1 parent 7613c25 commit 8a4ebdc1bd5890d3379bd4c8dd21220819905e93 @V0idExp committed Feb 3, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/ConfigOptsTree.cpp
@@ -23,7 +23,7 @@
#include "Error.h"
#include <boost/regex.hpp>
-#include <iostream>
+#include <sstream>
using namespace boost;
using namespace std;
@@ -83,10 +83,12 @@ ConfigOptsTree::ConfigOptsTree(const char separator):
throw ValueError("invalid separator '" + (String)&separator + "'");
// Prepend the escape character if the separator is any of ^$.*+?|()[]{}\ characters
+ ostringstream sepstr;
if(regex_match((String)&separator, special))
- _separator = String("\\") + (String)&separator;
- else
- _separator = (String)&separator;
+ sepstr << "\\";
+
+ sepstr << separator;
+ _separator = sepstr.str();
}
ConfigOptsTree::~ConfigOptsTree()

0 comments on commit 8a4ebdc

Please sign in to comment.