8 #include <boost/algorithm/string/replace.hpp>
23 static std::string
StripColors(std::string src,
bool forTM =
true)
25 std::regex color = std::regex(
"([$][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])");
26 src = std::regex_replace(src, color,
"");
28 std::regex wrongcolor = std::regex(
"([$][0-9a-fA-F][0-9a-fA-F])");
29 src = std::regex_replace(src, wrongcolor,
"");
31 src = std::regex_replace(src, std::regex(
"([$][$])"),
"\t");
32 std::regex formats = std::regex(
"([$][^hlp])");
33 src = std::regex_replace(src, formats,
"");
35 std::regex links = std::regex(
"[$][hlp](\\[.*?\\])");
36 src = std::regex_replace(src, links,
"");
37 src = std::regex_replace(src, std::regex(
"([$][hlp])"),
"");
41 boost::replace_all(src,
"\t",
"$$");
45 boost::replace_all(src,
"\t",
"$");
57 static std::string
StripLinks(std::string src,
bool forTM =
true)
59 src = std::regex_replace(src, std::regex(
"([$][$])"),
"\t");
61 std::regex links = std::regex(
"[$][hlp](\\[.*?\\])");
62 src = std::regex_replace(src, links,
"");
63 src = std::regex_replace(src, std::regex(
"([$][hlp])"),
"");
67 boost::replace_all(src,
"\t",
"$$");
71 boost::replace_all(src,
"\t",
"$");
78 #endif // FORMATTING_H_