Skip to main content
AllDevToolsHub
Back to all patterns

Go Module Path

Validation

Matches a Go module import path (e.g., github.com/anthropics/claude-code).

/^(?:[a-zA-Z0-9.-]+(?:\.[a-zA-Z0-9-]+)+)(?:/[a-zA-Z0-9._~-]+)+$/

How it works

Go module paths are domain-prefixed paths. The first segment must contain a dot (to look like a domain); subsequent segments are slash-separated identifiers.

Test Cases

Should Match

  • github.com/spf13/cobra
  • golang.org/x/net
  • k8s.io/api/core/v1

Should NOT Match

  • fmt
  • mylib
  • /local/path

Quick Summary

Matches a Go module import path (domain-prefixed, slash-separated).