Skip to content

Commit 3536124

Browse files
committed
Tweak the regex
1 parent 10b4e08 commit 3536124

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

extensions/ql-vscode/src/run-remote-query.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ async function getRepositories(): Promise<string[] | undefined> {
7878
}
7979
} else {
8080
void logger.log('No repository lists defined. Displaying text input box.');
81-
const repoRegex = /^(?:[a-zA-Z0-9]+-?)*[a-zA-Z0-9]\/[a-zA-Z0-9-_]+$/;
81+
/**
82+
* This regex matches strings of the form `owner/repo` where:
83+
* - `owner` is made up of alphanumeric characters or single hyphens, starting and ending in an alphanumeric character
84+
* - `repo` is made up of alphanumeric characters, hyphens, or underscores
85+
*/
86+
const repoRegex = /^(?:[a-zA-Z0-9]+-)*[a-zA-Z0-9]+\/[a-zA-Z0-9-_]+$/;
8287
const remoteRepo = await window.showInputBox({
8388
title: 'Enter a GitHub repository in the format <owner>/<repo> (e.g. github/codeql)',
8489
placeHolder: '<owner>/<repo>',

0 commit comments

Comments
 (0)