Skip to main content
AllDevToolsHub
Back to all patterns

GitHub owner/repo Path

Validation

Matches a GitHub owner/repository path like 'torvalds/linux'.

/^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}/[a-zA-Z0-9._-]{1,100}$/

How it works

Repo names allow dots, underscores, and hyphens (1–100 chars in practice). Combine with the username pattern for the owner segment.

Test Cases

Should Match

  • torvalds/linux
  • octocat/Hello-World
  • anthropics/claude-code

Should NOT Match

  • /linux
  • torvalds/
  • owner/repo/extra

Quick Summary

Matches GitHub owner/repo paths suitable for parsing URLs or CLI arguments.