Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-10-30 13:17:40


Jacques-Olivier Goussard wrote:
>> Hi
>> I'm trying to use the boost-regexp package and I'm facing an issue
>> with this.
>> I'm basically applying a replace algo on a list of strings using a
>> huge list of
>> regular expressions. It seems that the boost-regexp API allows me
>> only
>> to either load all regular expressions in memory (i.e creating the
>> regexp at process start) or load one regexp at a time but re-compile
>> it each time. Is there a way to save to disk the compiled version of
>> the regexp (so that the
>> regexp package would not have to re-create the statemachine) ?

No it's something I've often wondered about, but no one has really asked for
it: until now! :-)

The regex state machine isn't all that easily serializable since it's
basically a linked list, but more importantly it both contains locale
specific information, and caches some of std::locale's facet data. In
general that make serialization dangerous in that it gives an illusion of
portability that isn't really there: imagine what happens if you build a
regex under one locale and read back in under another, sadly bad things will
very likely happen :-(

>> If not, what would be the best approach for doing this ?

How desperate are you? Are there really that many regexes that loading them
from their string representation is a problem?

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net