本文介绍了在 VS Code 中搜索多个术语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在 VS Code 上搜索术语word1 word2".然后它会找到所有出现word1"后跟word2"的地方.实际上,我想找到 word1 和 word2 出现的所有文件,但它们不必是连续的.我该怎么做?

Suppose I search on VS Code the terms 'word1 word2'. Then it finds all the occurrences where 'word1' is followed by 'word2'. In reality I want to find all the files where word1 and word2 occur, but they don't have to be consecutive. How can I do it?

推荐答案

使用正则表达式标志并搜索 (word1[\s\S\n]*word2)|(word2[\s\S\n]*word1)

Use regex flag and search for (word1[\s\S\n]*word2)|(word2[\s\S\n]*word1)

基于@tonix regex 做了一个小扩展:

Made a small extension based on @tonix regex:

https://marketplace.visualstudio.com/items?itemName=usernamehw.search

这篇关于在 VS Code 中搜索多个术语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-22 11:43