VSCode查找不包含特定字符的所有引用

时间:2018-10-03 18:47:36

标签: regex visual-studio-code regex-lookarounds

如何在我的文件中查找包含< 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" >}}

2 个答案:

答案 0 :(得分:0)

这应该可行,假设您要匹配从{{}}的所有内容:

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

答案 1 :(得分:0)

仅告诉您{1.2}版本v1.29中已添加了超前支持。