Regular Expression String Length Function Cpp