Github搜索使用正则表达式 [英] Github search using regex

查看:205
本文介绍了Github搜索使用正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使用正则表达式在github仓库中搜索代码?

Is there any way to search code in a github repo using regular expressions?

目前,我克隆了回购和搜索。

Currently, I clone the repo and search.

但我想输入类似

s/foo/gi

并在代码中找到foo的所有发生:

and find all occurances of foo in the code:

foo.create
foo.extend
fooBar
barFoo
bar.foo

这可能吗?我是否在文档中缺少

Is this possible? Am I missing something in the docs?

推荐答案

因为它是一个Git仓库,为什么不在本地克隆它,然后使用 git grep 与它的正则表达式选项之一?:

Since it's a Git repo, why not just clone it locally, and then use git grep with one of it's regex options?:

git grep [-w | --word-regexp]
         [-E | --extended-regexp] [-G | --basic-regexp]
         [-P | --perl-regexp]

因此,也许符合

So maybe something along the lines of

$ git clone repo
$ git grep -w foo

这篇关于Github搜索使用正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆