diff --git a/docopt.cpp b/docopt.cpp index 937845d..be089e7 100644 --- a/docopt.cpp +++ b/docopt.cpp @@ -171,7 +171,7 @@ static std::vector parse_section(std::string const& name, std::stri "(?:^|\\n)" // anchored at a linebreak (or start of string) "(" "[^\\n]*" + name + "[^\\n]*(?=\\n?)" // a line that contains the name - "(?:\\n[ \\t].*?(?=\\n|$))*" // followed by any number of lines that are indented + "(?:\\n*[ \\t].*?(?=\\n|$))*" // followed by any number of blank lines, or lines that are indented ")", std::regex::icase }; diff --git a/docopt_private.h b/docopt_private.h index 931986b..7f2834a 100644 --- a/docopt_private.h +++ b/docopt_private.h @@ -532,7 +532,7 @@ namespace docopt { options_end = option_description.begin() + static_cast(double_space); } - static const std::regex pattern {"(-{1,2})?(.*?)([,= ]|$)"}; + static const std::regex pattern {"(-{1,2})?(.*?)([,= ]|$|\n)"}; for(std::sregex_iterator i {option_description.begin(), options_end, pattern, std::regex_constants::match_not_null}, e{}; i != e;