问题
I have a project with lots of Markdown files that include internal and external (start with http
) links. Some of these internal links don't have a .md file extension and so don't work when rendered outside of Jekyll.
Examples:
[link text 1](internal-link)
[link text 2](internal-link-2.md)
[link text 3](http://external-link...)
I am looking for a regular expression that only matches the first of these three cases - internal link without .md
file extension.
回答1:
After refining, this could be it:
\[[^]]+\]\((?!http:)(?!.+\.md).+\)
https://regex101.com/r/0uW1cl/5
(removed the capture Groups again)
来源:https://stackoverflow.com/questions/46850046/regular-expression-that-only-matches-internal-markdown-links-without-md-extensi