My own regex...............class?
i was thinking of designs, and i came across this one which led me to question, would this be an gross misuse of a class?
i'm fairly certain that this won't compile, but just pretend it will for now
Code:
string operator=(const Regex &r)
{
return r.return_string;
}
class Regex
{
friend string operator=(const Regex &);
public:
//ONE public function
Regex(string character_string, string expression);
protected:
string return_string;
//....a bunch of private funtions
}
int main()
{
string to_match = "a2bcd4";
string result = "";
//pretend like there is no need to escape any \'s here
string expression = "[a-z][0-9]\L\w+\E\d";
result = Regex(to_match, expression);
}