diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17ff26b..e65dbfa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ maddy uses [semver versioning](https://semver.org/).
*  Updated google test to v1.16.0.
*  clang-format
*  automatic update dependencies ci
+*  `(This is a [link](/ABC/some file) (the URL will include this).)` should not put the later parenthesis into the link url.
## version 1.3.0 2023-08-26
diff --git a/include/maddy/linkparser.h b/include/maddy/linkparser.h
index d6c72d0..2866a22 100644
--- a/include/maddy/linkparser.h
+++ b/include/maddy/linkparser.h
@@ -40,7 +40,7 @@ public:
*/
void Parse(std::string& line) override
{
- static std::regex re(R"(\[([^\]]*)\]\(([^\]]*)\))");
+ static std::regex re(R"(\[([^\]]*)\]\(([^)]*)\))");
static std::string replacement = "$1";
line = std::regex_replace(line, re, replacement);
diff --git a/tests/maddy/test_maddy_linkparser.cpp b/tests/maddy/test_maddy_linkparser.cpp
index b4adc6d..529c122 100644
--- a/tests/maddy/test_maddy_linkparser.cpp
+++ b/tests/maddy/test_maddy_linkparser.cpp
@@ -37,6 +37,22 @@ TEST(MADDY_LINKPARSER, ItReplacesMarkdownWithLinks)
ASSERT_EQ(expected, text);
}
+TEST(
+ MADDY_LINKPARSER, ItReplacesMarkdownProperlyEvenWithMultipleParenthesisInLine
+)
+{
+ std::string text =
+ "(This is a [link](/ABC/some file) (the URL will include this).)";
+ std::string expected =
+ "(This is a link (the URL will include "
+ "this).)";
+ auto linkParser = std::make_shared();
+
+ linkParser->Parse(text);
+
+ ASSERT_EQ(expected, text);
+}
+
// -----------------------------------------------------------------------------
class DISABLED_MADDY_LINKPARSER : public ::testing::Test
diff --git a/tools/format.py b/tools/format.py
index 7ee9403..09bd1f7 100644
--- a/tools/format.py
+++ b/tools/format.py
@@ -123,7 +123,7 @@ def main():
"""
if len(sys.argv) != 2:
print(
- "Usage: python check_clang_format.py "
+ "Usage: python format.py "
)
sys.exit(1)
else: