Hi,
I would like to change a regular expression in a compatible
way. Here is the use case. Initially, in the configuration I defined a reg-exp
for validation of data before persisting it. Some data was created and
persisted, later the reg-exp required a change, however, the change must be
done is such a way that existing data should not become invalid.
Example: Initial validation says “no ; (semi-colon)
and : (colon) in the text”.
However, later we decide to relax the constraint and want to
allow : (colon). By allowing this we are not invalidating any existing data and
hence this change should be allowed. However, we should not be changing the
configuration and add additional constraint, like now I don’t want to
allow _ (underscore) since there will be existing data that has _ (underscore).
I am using:
boost_1_46_1
Pseudo-code of APIs I am using:
#include <boost/xpressive/xpressive.hpp>
string regexPattern("^[^\\/?%*:|\"<>\.]+$");
boost::xpressive::sregex tmpRegex =
boost::xpressive::sregex::compile(regexPattern);
bool match
= boost::xpressive::regex_match(“value to validate”, tmpRegex);
Now I decide that I would start allowing . (dot) from now
on. Is there a way that will allow me to validate that whatever successfully
matches the old expression will also match the new expression
Regards,
Prakash Bande
Director - Hyperworks Enterprise Software
Altair Eng. Inc.
Troy MI
Ph: 248-614-2400 ext 489
Cell: 248-404-0292
My Secure Drop Box: https://ftam1.altair.com/dropbox/~Ursfnk