What is wrong with my RegEx?

 

I start to use the RegEx library https://www.mql5.com/en/code/15242 and get memory leaks and errors in the debbuger.

I do not see the difference of my first try ex02(). I copied from Test.mqh Example1_1(). Example1_1() works fine.

enum enum_example
  {
   Example1_1=0,
   ex02=1,
  };
input enum_example InpExample;

#include <RegularExpressions\Regex.mqh>
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   switch(InpExample)
     {
      case Example1_1 :
         Example1_1();
         break;
      case ex02 :
         ex02();
         break;
     }
   return(INIT_FAILED); // Unload the expert
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   CRegex::ClearCache();
  }
//+------------------------------------------------------------------+
//| Taken from Experts\Regexpression Demo\Tests.mqh                  |
//| (no memory leaks)                                                |
//+------------------------------------------------------------------+
void Example1_1()
  {
   string pattern="(\\d{3})-(\\d{3}-\\d{4})";
   string in="212-555-6666 906-932-1111 415-222-3333 brown 425-888-9999";
   CMatchCollection *matches=CRegex::Matches(in,pattern);
   CMatchEnumerator *en=matches.GetEnumerator();
   while(en.MoveNext())
     {
      CMatch *match=en.Current();
      Print("Area Code:        " + match.Groups()[1].Value());
      Print("Telephone number: " + match.Groups()[2].Value());
      Print("\0");
     }
   delete en;
   delete matches;
  }
//+------------------------------------------------------------------+
//| Memory leaks reported, in Debug errors in RegEx functions        |
//+------------------------------------------------------------------+
void ex02()
  {
   string in="Ger30JaC107 Ger30FbP110";
   string pattern="(Ger30)(Ja|Fb)(C|P)(\\d{3})";

   CMatchCollection *matches=CRegex::Matches(in,pattern);
   CMatchEnumerator *en=matches.GetEnumerator();
   while(en.MoveNext())
     {
      CMatch *match=en.Current();
      Print("Contract:        " + match.Groups()[1].Value());
      Print("Option Month     " + match.Groups()[2].Value());
      Print("Option Right     " + match.Groups()[3].Value());
      Print("Option Strike    " + match.Groups()[4].Value());
      Print("\0");
     }
   delete en;
   delete matches;
  }
RegularExpressions in MQL5 for working with regular expressions
RegularExpressions in MQL5 for working with regular expressions
  • www.mql5.com
Note: The library works on the MetaTrader 5 build 1285 and higher. Unzip the archive into the terminal_data_folder. The library codes are located in the: \MQL5\Include\RegularExpressions\ Sample test scripts can be found in the \MQL5\Scripts\RegularExpressionsExamples\ Here is a translation of the RegularExpressions from .Net Framework 4.6.1...
Reason: