#include <iostream>
#include <regex>
using namespace std;

int main() {
	bool caseInsensitive = true;
	char pattern[257] = "\\bword\\b";
	pattern[14] = '(';
	cout << "Pattern: " << pattern << endl;
	try
	{
		cout << "Flags: " << std::regex_constants::ECMAScript << endl;
		std::regex re(pattern, std::regex_constants::ECMAScript);
	}
	catch (std::regex_error &e)
	{
		cout << "Caught: " << e.what() << endl;
	}
	try
	{
		cout << "Flags: " << (std::regex_constants::ECMAScript | (caseInsensitive ? std::regex_constants::icase : 0)) << endl;
		std::regex re(pattern, std::regex_constants::ECMAScript | (caseInsensitive ? std::regex_constants::icase : 0));
	}
	catch (std::regex_error &e)
	{
		cout << "Caught: " << e.what() << endl;
	}
	return 0;
}