C++ Mathematical Expression Library (ExprTk)  http://www.partow.net/programming/exprtk/index.html
diff --git a/exprtk.hpp b/exprtk.hpp
index 5fb615a..b11c6a9 100644
--- a/exprtk.hpp
+++ b/exprtk.hpp
@@ -250,9 +250,12 @@
 
       inline void cleanup_escapes(std::string& s)
       {
-         std::string::iterator itr1 = s.begin();
-         std::string::iterator itr2 = s.begin();
-         std::string::iterator end  = s.end  ();
+         typedef std::string::iterator str_itr_t;
+
+         str_itr_t itr1 = s.begin();
+         str_itr_t itr2 = s.begin();
+         str_itr_t end  = s.end  ();
+
          std::size_t removal_count  = 0;
 
          while (end != itr1)
@@ -270,7 +273,7 @@
                      case 'n' : (*itr1) = '\n'; break;
                      case 'r' : (*itr1) = '\r'; break;
                      case 't' : (*itr1) = '\t'; break;
-                     case '0' : parse_hex(itr1,end,(*itr1));
+                     case '0' : parse_hex(itr1, end, (*itr1));
                                 removal_count += 3;
                                 break;
                   }
@@ -2505,7 +2508,7 @@
 
             while (!is_end(s_itr_))
             {
-               if ('\\' == *s_itr_)
+               if (!escaped && ('\\' == *s_itr_))
                {
                   escaped_found = true;
                   escaped = true;
diff --git a/exprtk_test.cpp b/exprtk_test.cpp
index c3c819b..93a3d10 100644
--- a/exprtk_test.cpp
+++ b/exprtk_test.cpp
@@ -2266,7 +2266,11 @@
                              test_ab<T>("'\\0x30\\n\\0x31\\n\\0x32\\n\\0x33' == '0\\n1\\n2\\n3'" ,"","",T(1.0)),
                              test_ab<T>("('\\0x30' + '') == '0'"                                 ,"","",T(1.0)),
                              test_ab<T>("('\\0x30' + '\\0x31\\0x32') == '012'"                   ,"","",T(1.0)),
-                             test_ab<T>("('\\0x30' + '\\0x31\\0x32' + '\\0x33\\0x34\\0x35') == '012345'" ,"","",T(1.0))
+                             test_ab<T>("('\\0x30' + '\\0x31\\0x32' + '\\0x33\\0x34\\0x35') == '012345'" ,"","",T(1.0)),
+                             test_ab<T>("'a\\'\\\\b' == a" ,"a'\\b","",T(1.0)),
+                             test_ab<T>("'a\\\\\\'b' == a" ,"a\\'b","",T(1.0)),
+                             test_ab<T>("'a\\'\\\\\\\\b' == a" ,"a'\\\\b","",T(1.0)),
+                             test_ab<T>("'a\\0x30\\'\\0x31\\\\\\0x32b' == a" ,"a0'1\\2b","",T(1.0))
                            };
 
    static const std::size_t test_list_size = sizeof(test_list) / sizeof(test_ab<T>);
@@ -2323,10 +2327,14 @@
 
          if (not_equal(expr_result,test.result))
          {
-            printf("run_test02() - Computation Error:  Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\n",
+            printf("run_test02() - Computation Error:  Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\t"
+                   "a='%s'\tb='%s'\tc='%s'\n",
                    test.expr.c_str(),
                    (double)test.result,
-                   (double)expr_result);
+                   (double)expr_result,
+                   str_a.c_str(),
+                   str_b.c_str(),
+                   str_c.c_str());
 
             result = false;
             continue;