Discussion of article "Regular expressions for traders"

 

New article Regular expressions for traders has been published:

A regular expression is a special language for handling texts by applying a specified rule, also called a regex or regexp for short. In this article, we are going to show how to handle a trade report with the RegularExpressions library for MQL5, and will also demonstrate the optimization results after using it.

They are able to carry out two main functions:

  • search for a pattern in strings;
  • replace a pattern found.

When creating patterns for regular expressions, as previously mentioned, special characters, metacharacters and classes (sets) of characters are used. It means a regular expression is a regular string, and all non-special (non-reserved) characters are considered regular. 

The search of a specified pattern in a string is performed by a regular expression handler.  In .NET Framework, and, therefore, in the RegularExpressions library for MQL5, a regular expression handler backtracks for regular expressions. It is a variation of a traditional NFA (Nondeterministic Finite Automaton), the same as those applied in Perl, Python, Emacs and Tcl. It is used to replace pattern-matches found in a string.

Author: MetaQuotes Software Corp.

 
I can't run your examples on MT5 build1340, because when compiling TableListView.mqh I get the error "can't open "C:\Program Files\MetaTrader 5\MetaTrader 5\mql5\15242\Include\Controls\WndClient.mqh" include file TableListView.mqh 7 11" and "can't open "C:\Program Files\MetaTrader 5\mql5\15242\Include\Controls\Edit.mqh" include file TableListView.mqh 8 11". Maybe they should be unpacked into the standard MQL5 "Include" folder instead of "MQL5\15242\Include" ?


 
This is a very interesting topic. It never occurred to me to use regulars in MQL before.
 
Alexander:
I can't run your examples on my MT5 build1340, because during compilation.
Thanks for the message, fixed