MQL4 中的正则表达式用于处理正则表达式 - MetaTrader 4 库


微软公司。源代码取自.Net框架4.6.1。
注意:该库适用于 MetaTrader 4 版本 1384 及更高版本。
将存档解压到终端数据文件夹。
库代码位于:
示例测试脚本可以在
以下是 .Net Framework 4.6.1 中正则表达式的翻译。
要使用该库,请将“\MQL4\Include\RegularExpressions\”目录中的 Regex.mqh 文件包含在代码中。
几个 该库提供了说明性示例,同时 时间作为测试用例。所有样品均取自 的官方网站微软公司,它们生动地展示了与 C# 中正则表达式的主要区别以及它们在 MQL4 中的使用特点。
以下是有关正则表达式 MQL4 移植库包的更多详细信息:
文件中的正则表达式参数正则表达式选项.mqh:
使用 MQL4 的正则表达式:
//--- C# 代码正则表达式 rx =新的正则表达式(@"\b(?<字>\w+)\s+(\k<字>)\b", RegexOptions.IgnoreCase); 细绳文字 =“那只敏捷的棕色狐狸跳过了那只懒狗。”; MatchCollection matches = rx.Matches(text);foreach(比赛比赛在匹配) { //--- 处理 }//--- MQL4 代码正则表达式 *rx =新的正则表达式(“\\b(?<字>\\w+)\\s+(\\k<字>)\\b”, RegexOptions::IgnoreCase); 细绳文字 =“那只敏捷的棕色狐狸跳过了那只懒狗。”; MatchCollection *matches = rx.Matches(text); IEnumerator*en = matches.GetEnumerator();尽管(en.MoveNext()) { 匹配 *match = en.Current(); //--- 处理}删除接收;删除比赛;删除恩; 正则表达式::清除缓存();
/span></li><li><span>从上面的例子可以看出,C#语法允许将'@'符号放在字符串前面</span到
忽略其中的所有格式标记。在 MQL4 中,这种方法不是
提供,因此正则表达式模式中的所有控制字符
应明确定义。
要了解更多有关MQL4 的正则表达式及其功能,使用提供的测试.mqh专家。 It implements numerous examples of regular expression usage, which cover all the main functionality of the library.

附件下载
📎 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
💡 精彩内容推荐
✍️ 楼主最新发布
- •
- •
- •
- •
- •
- •
🔗 您可能感兴趣
- •
- •
- •
- •
- •
- •
