Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A gadget to enhance QM rx?
#3
The answer of ChatGPT:

What is the method to use PCRE2 regular expressions in Quick macros?
​​​​​​​
QM does not support PCRE2 regular expressions natively. However, it is possible to use PCRE2 regular expressions in QM by compiling the PCRE2 library as a dynamic link library (DLL) and then calling the library functions through QM's DLL command. You can write QM functions to wrap the PCRE2 DLL functions for use in QM scripts.
To use PCRE2 regular expressions in QM, you need to have the PCRE2 library and header files installed on your computer. Then, you need to compile the PCRE2 library as a DLL file. You can compile it using a compiler like Visual Studio, or you can use a pre-compiled DLL.
Once you have the PCRE2 DLL file, you can load and call its functions using QM's DLL command, as shown in the previous example. You can also create QM functions to provide a more user-friendly interface for using PCRE2 regular expressions in QM scripts.
Overall, while it requires some additional work to set up and use PCRE2 regular expressions in QM, it is possible and provides more powerful and flexible regular expression capabilities than QM's built-in regular expression functions.

How to use QM's dynamic link library (DLL) command to call a compiled PCRE2 dynamic link library?
 You can use QM's dynamic link library (DLL) command to call a precompiled PCRE2 dynamic link library. Here is a basic example:
 
Code:
Copy      Help
int hDll = dll.Open("pcre2.dll")  // Load the PCRE2 DLL and obtain a handle
string str = "Hello, world!"
dll.Call(hDll, "pcre2_match", "rRs", str, "Hello")  // Call the pcre2_match function of PCRE2 for matching
dll.Free(hDll)  // Release the DLL handle and free resources
This example assumes that the PCRE2 dynamic link library has been precompiled and saved as pcre2.dll on the local disk. First, load the PCRE2 DLL and obtain a handle by using the dll.Open function. Then, use the dll.Call function to call the pcre2_match function of PCRE2 for string matching. Finally, release the DLL handle and free resources with the dll.Free function.
Please note that this is just a basic example, and the specific implementation process may need to be adjusted based on the interface of the PCRE2 DLLand the syntax of QM's dynamic link library command.

ChatGPT seems to have little understanding of the QM language and the code is incorrect  Wink


Messages In This Thread
A gadget to enhance QM rx? - by Davider - 03-13-2023, 03:36 AM
RE: A gadget to enhance QM rx? - by Davider - 03-30-2023, 11:50 PM
RE: A gadget to enhance QM rx? - by Davider - 04-12-2023, 01:23 PM
RE: A gadget to enhance QM rx? - by Davider - 04-12-2023, 02:24 PM
RE: A gadget to enhance QM rx? - by Gintaras - 04-12-2023, 03:02 PM
RE: A gadget to enhance QM rx? - by Davider - 04-15-2023, 03:23 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)