Download MetaTrader 5

Discussion of article "Regular expressions for traders"

To add comments, please log in or register
Post web links to other trader's signals and make profit
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2016.07.06 13:09 

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.

To add comments, please log in or register