Commits

mpodonyi  committed b8446be

more work

  • Participants
  • Parent commits 8e964de

Comments (0)

Files changed (1)

File TemplateStrings/Template.cs

                 bool hasval = false;
                 if (!string.IsNullOrEmpty(value.EndDelimiterEscape))  //means has also start delimiter
                 {
-                    //builder.AppendFormat("(?<escapedend>{0})", Regex.Escape(value.EndDelimiterEscape));
-                    builder.AppendFormat("(?<escapedstart>{0})(?<named>{1})(?<escapedend>{2})", value.StartDelimiterEscape != null ? Regex.Escape(value.StartDelimiterEscape) : string.Empty, value.IdPattern, Regex.Escape(value.EndDelimiterEscape));
+                    builder.AppendFormat("((?<escapedstart>{0})|(?<escapedstart>{1}))(?<named>{2})(?<escapedend>{3})", value.StartDelimiterEscape != null ? Regex.Escape(value.StartDelimiterEscape) : string.Empty, value.StartDelimiter != null ? Regex.Escape(value.StartDelimiter) : string.Empty, value.IdPattern, Regex.Escape(value.EndDelimiterEscape));
 
                     hasval = true;
                 }
                     if (hasval)
                         builder.Append('|');
 
-                    //devide here if end delimier exist or not
+                    builder.AppendFormat("((?<escapedstart>{0})|(?<escapedstart>{1}))(?<named>{2})(?<escapedend>{3})", value.StartDelimiterEscape != null ? Regex.Escape(value.StartDelimiterEscape) : string.Empty, value.StartDelimiter != null ? Regex.Escape(value.StartDelimiter) : string.Empty, value.IdPattern, Regex.Escape(value.EndDelimiterEscape));
 
-                    if (string.IsNullOrEmpty(value.EndDelimiter))
-                    {
-                        builder.AppendFormat("(?<escapedstart>{0}){1}{2}", Regex.Escape(value.StartDelimiterEscape), value.IdPattern, Regex.Escape(value.EndDelimiter));
-                    
-                    }
-                    else
-                    {
-                        builder.AppendFormat("(?<escapedstart>{0}){1}", Regex.Escape(value.StartDelimiterEscape), value.IdPattern, Regex.Escape(value.EndDelimiter));
-                                            
-                    }
-
-
-                    
                     hasval = true;
                 }
 
             return builder.ToString();
         }
 
-        public static string[,] PythonTestInternal={{"Lorem $ipsum dolor sit amet.","Lorem test1 dolor sit amet."},
+        public static string[,] PythonTestInternal=
+                                 {{"Lorem $ipsum dolor sit amet.","Lorem test1 dolor sit amet."},
                                   {"Lorem ${ipsum} dolor sit amet.","Lorem test1 dolor sit amet."},
-                                  {"Lorem $$ipsum dolor sit amet.","Lorem $ipsum dolor sit amet."},  //2
+                                  {"Lorem $$ipsum dolor sit amet.","Lorem $ipsum dolor sit amet."},  //2  //what differ
                                   {"Lorem $${ipsum} dolor sit amet.","Lorem ${ipsum} dolor sit amet."}};  //2
 
 
-        public static string[,] MvcTestInternal={{"Lorem {ipsum} dolor sit amet.","Lorem test1 dolor sit amet."},
+        public static string[,] MvcTestInternal=
+                                 {{"Lorem {ipsum} dolor sit amet.","Lorem test1 dolor sit amet."},
                                   {"Lorem {{ipsum}} dolor sit amet.","Lorem {ipsum} dolor sit amet."},   //1
                                   {"Lorem {ipsum}} dolor sit amet.","Lorem test1} dolor sit amet."},
                                   {"Lorem {{ipsum} dolor sit amet.","Lorem {test1 dolor sit amet."},
                                   {"Lorem ipsum}} dolor sit amet.","Lorem ipsum}} dolor sit amet."}};
 
        
+//((?<escapedstart>\{\{)  |  (?<start>\{))
+
+//(?<named>[_a-z][_a-z0-9]*)
+
+//((?<escapedend>}})  |  (?<end>}))
 
 
         public string Substitute(IDictionary<string, string> mapping, bool throwNoException)