我想搜索,例如'carousel' 并排除其中包含 'react' 的结果。我尝试过:
carousel -react
和
carousel NOT react
但这仍然会显示带有“react”的结果。如何排除 npm 上的搜索词?
最佳答案
How can I exclude search terms on npm?
如果您在 shell 中询问 NPM 搜索,我认为排除单词的唯一方法是使用搜索正则表达式以下是 NPM 搜索文档的摘录:
If a term starts with /, then it's interpreted as a regular expression. A trailing / will be ignored in this case. (Note that many regular expression characters must be escaped or quoted in most shells.)
正则表达式搜索的一个非常简单的示例是:
npm search /carousel/
实现实际的正则表达式来排除react超出了这个问题的范围,它会涉及创建一个负向前看/向后看正则表达式。
关于javascript - 如何排除 npm 上的搜索词?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29559180/