Regular Expressions in MQL4 for working with regular expressions - MetaTrader 4 Library - MT4/MT5 Resources


Microsoft Corporation. Source code taken from .Net Framework 4.6.1 .
Note: This library is available for MetaTrader 4 version 1384 and higher.
Extract the archive to the terminal data folder .
Library code is located at:
Sample test scripts can be found at
The following is the translation of regular expressions in .Net Framework 4.6.1.
To use the library, include the Regex.mqh file in the "\MQL4\Include\RegularExpressions\" directory into your code.
Several illustrative examples are provided with the library, along with examples as test cases. All samples are taken from the official website of Microsoft Corporation , and they vividly demonstrate the main differences with regular expressions in C# and the characteristics of their use in MQL4.
Here are more details about the Regular Expressions MQL4 porting library package:
Regular expression parameters in the file regexoptions.mqh :
Regular expressions using MQL4:
//--- C# code regular expression rx = new regular expression ( @"\b(?<word>\w+)\s+(\k<word>)\b" , RegexOptions.IgnoreCase); string text = "The quick brown fox jumped over the lazy dog." ; MatchCollection matches = rx.Matches(text); foreach (match match in match) { ; MatchCollection *matches = rx.Matches(text); IEnumerator*en = matches.GetEnumerator(); although (en.MoveNext()) { Match *match = en.Current(); //--- handle } delete receive; delete match; delete en; Regular Expression:: ClearCache ();
To learn more about MQL4 regular expressions and their functionality, use the test provided by .mqh Expert. It implements numerous examples of regular expression usage, which cover all the main functionality of the library.

Attachment download
📎 TableListView.mqh (60.38 KB)
📎 Tests.mq4 (139.5 KB)
📎 Array.mqh (22.36 KB)
📎 DynamicMatrix.mqh (22.04 KB)
📎 IComparable.mqh (4.98 KB)
📎 Wrappers.mqh (17.96 KB)
📎 Collection.mqh (12.54 KB)
📎 Dictionary.mqh (42.58 KB)
📎 EqualityComparer.mqh (8.65 KB)
📎 ICollection.mqh (6.15 KB)
📎 IComparer.mqh (6.62 KB)
📎 IDictionary.mqh (6.88 KB)
📎 IEnumerable.mqh (5.31 KB)
📎 IEnumerator.mqh (10.39 KB)
📎 IEqualityComparer.mqh (4.62 KB)
📎 IList.mqh (5.7 KB)
📎 KeyValuePair.mqh (6.34 KB)
📎 LinkedList.mqh (28.29 KB)
📎 List.mqh (38.77 KB)
📎 TimeSpan.mqh (31.7 KB)
📎 TimeSpanFormat.mqh (30.28 KB)
📎CharUnicodeCategory.txt (23.5 KB)
📎 Regex.mqh (57.05 KB)
📎 RegexBoyerMoore.mqh (18.01 KB)
📎 RegexCapture.mqh (7.86 KB)
📎 RegexCaptureCollection.mqh (10.25 KB)
📎 RegexCharClass.mqh (97.97 KB)
📎 RegexCode.mqh (22.25 KB)
📎 RegexFCD.mqh (31.25 KB)
📎 RegexGroup.mqh (8.72 KB)
📎 RegexGroupCollections.mqh (11.25 KB)
📎 RegexInterpreter.mqh (49.63 KB)
📎 RegexMatch.mqh (22.94 KB)
📎 RegexMatchCollection.mqh (11.04 KB)
📎 RegexNode.mqh (32.45 KB)
📎 RegexOptions.mqh (14.82 KB)
📎 RegexParser.mqh (93.16 KB)
📎 RegexReplacement.mqh (20.83 KB)
📎 RegexRunner.mqh (31.1 KB)
📎 RegexTree.mqh (8.47 KB)
📎 RegexWriter.mqh (24.26 KB)
Source: MQL5 #16566
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •