Regex - check if pattern found

To add comments, please log in or register
samjesse
646
samjesse  

Hi

This code is expected to test a string to find if a regex pattern matches. I am not able to pull it together. Please help.  Thanks

  #include <RegularExpressions\Regex.mqh>
  string pattern="\d*\\|\event\b";  // test for the string "4|event" or "25|event" 
  Regex *rx = new Regex(pattern, RegexOptions::IgnoreCase); 

Compile time errors, first one is:

Regex - undeclared identifier

However the step is take from the example in https://www.mql5.com/en/code/15242

RegularExpressions in MQL5 for working with regular expressions
RegularExpressions in MQL5 for working with regular expressions
  • www.mql5.com
Note: The library works on the MetaTrader 5 build 1285 and higher. Unzip the archive into the terminal_data_folder. The library codes are located in the: \MQL5\Include\RegularExpressions\ Sample test scripts can be found in the \MQL5\Scripts\RegularExpressionsExamples\ Here is a translation of the RegularExpressions from .Net Framework 4.6.1...
Qoyyuum Kadir
129
Qoyyuum Kadir  
samjesse:

Hi

This code is expected to test a string to find if a regex pattern matches. I am not able to pull it together. Please help.  Thanks

Compile time errors, first one is:

Regex - undeclared identifier

However the step is take from the example in https://www.mql5.com/en/code/15242


Not sure if this will work but try this:

\d+\|event\b
To add comments, please log in or register