Skip to content

fix: correct GitHub URL regex pattern and add tests#2742

Open
sijie-Z wants to merge 1 commit into
DeepSourceCorp:masterfrom
sijie-Z:fix/url-regex
Open

fix: correct GitHub URL regex pattern and add tests#2742
sijie-Z wants to merge 1 commit into
DeepSourceCorp:masterfrom
sijie-Z:fix/url-regex

Conversation

@sijie-Z

@sijie-Z sijie-Z commented Jun 2, 2026

Copy link
Copy Markdown

The original regex used a character class [http://|https://] which would match individual characters like 'h', 't', 'p', etc. instead of the full protocol prefix. Replaced with proper non-capturing group (?:https?://)?.

Also escaped the dot in github.com to prevent matching non-dot characters.

Added unit tests for the regex covering:

  • Standard HTTPS URLs
  • HTTP URLs
  • URLs without protocol
  • Trailing slashes
  • Dots in owner/name
  • Non-GitHub URLs (no match)
  • Invalid strings (no match)
  • AI Disclosure: This PR was created with assistance from Claude Code.

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

@sijie-Z is attempting to deploy a commit to the DeepSource Team on Vercel.

A member of the Team first needs to authorize it.

The original regex used a character class [http://|https://] which would
match individual characters like 'h', 't', 'p', etc. instead of the full
protocol prefix. Replaced with proper non-capturing group (?:https?://)?.

Also escaped the dot in github.com to prevent matching non-dot characters.

Added unit tests for the regex covering:
- Standard HTTPS URLs
- HTTP URLs
- URLs without protocol
- Trailing slashes
- Dots in owner/name
- Non-GitHub URLs (no match)
- Invalid strings (no match)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant