/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <regex>
int main()
{
std::cout<<"Hello World" << std::endl;
const std::regex toPrettifyRX_ACTUAL(R"(\[?\|([a-zA-Z]+)\]?)");
std::string str = "[|a] [r]\n[s] [t]";
str = std::regex_replace(str, toPrettifyRX_ACTUAL, "$1");
std::cout << str << std::endl;
std::cout << std::endl <<"NEW REGEX : " << std::endl;
const std::regex toPrettifyRX_NEW(R"(\[?\|?([a-zA-Z]+)\]?)"); // note the ?
std::string str_2 = "[|a] [r]\n[s] [t]";
str_2 = std::regex_replace(str_2, toPrettifyRX_NEW, "$1");
std::cout << str_2 << std::endl;
return 0;
}