You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use `/pattern/` syntax to run a regex search. The CLI automatically derives a safe API query term and filters results locally — no manual post-processing needed. Use `--regex-hint` to override the derived term when auto-extraction is too broad.
93
+
86
94
## Why not `gh search code`?
87
95
88
96
The official [`gh` CLI](https://cli.github.com/) does support `gh search code`, but it returns a **flat paginated list** — one result per line, no grouping, no interactive selection, no structured output.
Copy file name to clipboardExpand all lines: docs/.vitepress/theme/ComparisonTable.vue
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,13 @@ const ROWS: Row[] = [
59
59
gcs: true,
60
60
docLink: "/usage/interactive-mode",
61
61
},
62
+
{
63
+
feature: "Regex queries (/pattern/flags)",
64
+
desc: "Use full regular expressions in queries — top-level alternation (A|B|C) maps to GitHub OR, client-side filtering applies the real pattern. GitHub supports regex in the web UI only, not in the REST API or gh CLI.",
65
+
gh: false,
66
+
gcs: true,
67
+
docLink: "/usage/search-syntax",
68
+
},
62
69
{
63
70
feature: "Pagination (up to 1\u202f000 results)",
64
71
desc: "Both tools auto-paginate the GitHub search API \u2014 up to 1\u202f000 results per query.",
headline: "Which repos are pinned to a vulnerable minor version?",
57
+
description:
58
+
"Use regex syntax to target a precise version range — something a plain keyword search cannot do. Find every repo still locked to axios 1.x, react 17.x, or any other outdated pin, then export the list to a migration issue.",
|`--org <org>`| string | ✅ | — | GitHub organization to search in. Automatically injected as `org:<org>` in the query. |
37
-
|`--exclude-repositories <repos>`| string | ❌ |`""`| Comma-separated list of repositories to exclude. Short form (`repoA,repoB`) or full form (`org/repoA,org/repoB`) both accepted. |
38
-
|`--exclude-extracts <refs>`| string | ❌ |`""`| Comma-separated extract refs to exclude. Format: `repoName:path/to/file:index`. Short form (without org prefix) accepted. |
39
-
|`--no-interactive`| boolean (flag) | ❌ |`true` (on) | Disable interactive mode. Interactive mode is **on** by default; pass this flag to disable it. Also triggered by `CI=true`. |
40
-
|`--format <format>`|`markdown`\|`json`| ❌ |`markdown`| Output format. See [Output formats](/usage/output-formats). |
|`--include-archived`| boolean (flag) | ❌ |`false`| Include archived repositories in results (excluded by default). |
43
-
|`--group-by-team-prefix <prefixes>`| string | ❌ |`""`| Comma-separated team-name prefixes for grouping result repos by GitHub team (e.g. `squad-,chapter-`). Requires `read:org` scope. |
44
-
|`--no-cache`| boolean (flag) | ❌ |`true` (on) | Bypass the 24 h team-list cache and re-fetch teams from GitHub. Cache is **on** by default; pass this flag to disable it. Only applies with `--group-by-team-prefix`. |
|`--org <org>`| string | ✅ | — | GitHub organization to search in. Automatically injected as `org:<org>` in the query. |
37
+
|`--exclude-repositories <repos>`| string | ❌ |`""`| Comma-separated list of repositories to exclude. Short form (`repoA,repoB`) or full form (`org/repoA,org/repoB`) both accepted. |
38
+
|`--exclude-extracts <refs>`| string | ❌ |`""`| Comma-separated extract refs to exclude. Format: `repoName:path/to/file:index`. Short form (without org prefix) accepted. |
39
+
|`--no-interactive`| boolean (flag) | ❌ |`true` (on) | Disable interactive mode. Interactive mode is **on** by default; pass this flag to disable it. Also triggered by `CI=true`. |
40
+
|`--format <format>`|`markdown`\|`json`| ❌ |`markdown`| Output format. See [Output formats](/usage/output-formats). |
|`--include-archived`| boolean (flag) | ❌ |`false`| Include archived repositories in results (excluded by default). |
43
+
|`--group-by-team-prefix <prefixes>`| string | ❌ |`""`| Comma-separated team-name prefixes for grouping result repos by GitHub team (e.g. `squad-,chapter-`). Requires `read:org` scope. |
44
+
|`--no-cache`| boolean (flag) | ❌ |`true` (on) | Bypass the 24 h team-list cache and re-fetch teams from GitHub. Cache is **on** by default; pass this flag to disable it. Only applies with `--group-by-team-prefix`. |
45
+
|`--regex-hint <term>`| string | ❌ | — | Override the API search term used when the query is a regex (`/pattern/`). Useful when auto-extraction produces a term that is too broad or too narrow. See [Regex queries](/usage/search-syntax#regex-queries). |
github-code-search "password= language:TypeScript NOT filename:test" --org fulll
78
78
```
79
79
80
+
## Regex queries
81
+
82
+
`github-code-search` supports regex syntax using the `/pattern/flags` notation, just like the GitHub web UI.
83
+
84
+
Because the GitHub Code Search API does not natively support regex, the CLI automatically extracts a representative literal term from the regex to send to the API, then filters the returned results locally with the full pattern. In most cases this is fully transparent.
85
+
86
+
```bash
87
+
# Imports using the axios module (any quote style)
The GitHub Code Search API returns **at most 1,000 results** per query. The regex filter
124
+
is applied to those results; results beyond the API cap can never be seen. Refine the
125
+
query with qualifiers (`language:`, `path:`, `filename:`) to keep the result set small.
126
+
:::
127
+
80
128
## API limits
81
129
82
130
The GitHub Code Search API returns at most **1,000 results** per query. If your query returns more, refine it with qualifiers (especially `language:` or `path:`) to stay below the limit.
0 commit comments