I am using <regex> from Visal Studio 2010. I understand that when I create a regular expression object, it compiles. There is no compilation method like in other languages โโand libraries, but I think how it works, am I right?
I need to store a large number of these compiled regular expressions in a file, so I just get a piece of memory block and get a compiled regular expression.
I canโt figure out how to do this. I found that in PCRE this is possible , but it is a Linux library. There is Windows [version 2 , but it is 3 years old, and I would like to use a higher-level approach (there is no C ++ shell in the Windows version).
So is it possible to use save std:regex or boost::regex (is it the same?) As a piece of memory, and then just reuse it later?
Or is there another simple library for Windows that allows this?
EDIT: Thanks for the great answers. I will just check if it is enough to just store the regular expression as a string, and then if it is slow, I will test and compare it with this old PCRE library.
c ++ regex serialization visual-c ++ boost-regex
Mariusz pawelski
source share