Skip to main content

GITHUB_PERMALINK_REGEX

Static GITHUB_PERMALINK_REGEX 

Source
static GITHUB_PERMALINK_REGEX: LazyLock<Regex>
Expand description

Regex pattern for matching GitHub blob URLs.

Captures: owner, repo, git_ref (commit SHA or branch name), path, and optional line range fragment.

Supported patterns:

  • https://github.com/{owner}/{repo}/blob/{ref}/{path}
  • https://github.com/{owner}/{repo}/blob/{ref}/{path}#L{line}
  • https://github.com/{owner}/{repo}/blob/{ref}/{path}#L{start}-L{end}

The {ref} can be a commit SHA (e.g., abcdef1234567) or a branch/tag name (e.g., main, feature/foo).