diff --git a/include/maddy/strongparser.h b/include/maddy/strongparser.h index cda6d21..c2dc441 100644 --- a/include/maddy/strongparser.h +++ b/include/maddy/strongparser.h @@ -30,9 +30,9 @@ public: /** * Parse * - * From Markdown: `text **text**` + * From Markdown: `text **text** __text__` * - * To HTML: `text text` + * To HTML: `text text text` * * @method * @param {std::string&} line The line to interpret @@ -41,10 +41,16 @@ public: void Parse(std::string& line) override { - static std::regex re("(?!.*`.*|.*.*)\\*\\*(?!.*`.*|.*<\\/code>.*)([^\\*\\*]*)\\*\\*(?!.*`.*|.*<\\/code>.*)"); + static std::vector res + { + std::regex{"(?!.*`.*|.*.*)\\*\\*(?!.*`.*|.*<\\/code>.*)([^\\*\\*]*)\\*\\*(?!.*`.*|.*<\\/code>.*)"}, + std::regex{"(?!.*`.*|.*.*)\\_\\_(?!.*`.*|.*<\\/code>.*)([^\\_\\_]*)\\_\\_(?!.*`.*|.*<\\/code>.*)"} + }; static std::string replacement = "$1"; - - line = std::regex_replace(line, re, replacement); + for (const auto& re : res) + { + line = std::regex_replace(line, re, replacement); + } } }; // class StrongParser