|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-08-08 01:49:59
Edward Diener wrote:
> That is a good point. However you always know what flags are passed to the
> regex function since they are available. That's not arguing against such a
> function as being part of the library itself but it is still doable by you.
> Furthermore you can set the flag mode you like to simplify your escaping,
> but of course this is not a general solution as the rest of the regular
> expression may require particular flags set.
That's the point and that's why I am asking for a library-based
function. Sure I can write one myself, but this will always be a limited
version of what the library could provide. I think the conversion
function should accept the same flags like regex itself. Here's a signature:
template< typename stringT >
stringT convert_to_regex_literals( const stringT& s,
flag_type f = regbase::normal );
I don't know whether we also need to provide traits somewhere, but I
think John is the expert to answer that. (Yes, the name of the function
is ugly - please find a better one :)
IMHO the library is the best place to implement such a function and keep
it up-to-date and consistent. If we are lucky, it's also easier than
doing it as a separate function as a function which is part of the
library might be able to use some internals to create an easier
implementation.
> That is not true. One just needs to read and understand the documentation on
> the particular flags and what they mean. There are no "secret innards" which
> retain information about escaping characters which you can't find for
> yourself by testing the flags.
Whatever I can do as a user, I think we've seen that I am not the only
one who needs such a function and it doesn't make sense to reinvent it
over and over again. Even if it's just for convenience, I think it's a
desirable extension for the regex-library.
Regards, Daniel
-- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk