Boost logo

Boost Users :

Subject: [Boost-users] Regex comparision
From: Prakash Reddy Bande (prakashr_at_[hidden])
Date: 2013-09-09 11:53:02


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:

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


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:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at