首页 > 解决方案 > VSCode 查找所有不包含某个字符的引用

问题描述

如何在我的文件中找到包含< relref "和不包含/#之后的所有实例"

我试过使用正则表达式前瞻,即,< relref "((?!/).)*但它们在 VSCode 中不受支持

简单来说:

These should match:

{{< relref "blog/foo.md" >}}
{{< relref "blog/2018/10/09/foo.md" >}}
{{< relref "bar.md" >}}



These should not match:

{{< relref "/bar.md" >}}
{{< relref "#anchor" >}}
{{< relref "/foo/bar.md" >}}

标签: regexvisual-studio-coderegex-lookarounds

解决方案


假设您想要匹配从{{to的所有内容,这应该可以工作}}

{{< relref "[^\/#][^"]*" >}}


推荐阅读