You can't return a value from out of a constructor. Thats effectively what you're trying to do in main, with the line

Code:
result = Regex(to_match, expression);
Maybe the line you're looking for is
Code:
  Regex r(result, to_match, expression)
You can change the compiler to take three arguments, the first a pointer or reference. That would work, I think.