Download MetaTrader 5

New article: Regular expressions for traders

To add comments, please log in or register
Do you want to become a well-known developer? Execute the orders of traders in the Freelance service!
MetaQuotes Software Corp.
Moderator
181417
MetaQuotes Software Corp. 2016.07.06 11:14 

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