Skip to content
Snippets Groups Projects
Select Git revision
  • 57ebc48e28a6688c5e07235b3ead6856575a88c9
  • master default protected
  • v1.4.5
  • v1.4.4
  • v1.4.3
  • v1.4.2
  • v1.4.1
  • v1.4.0
  • v1.3.10
  • v1.3.9
  • v1.3.8
  • v1.3.7
  • v1.3.6
  • v1.3.5
  • v1.3.4
  • v1.3.3
  • v1.3.2
  • v1.3.1
  • v1.3.0
  • v1.2.9
  • v1.2.8
  • v1.2.7
22 results

misc.go

Blame
  • misc.go 617 B
    package store
    
    import (
    	"errors"
    	"regexp"
    )
    
    const letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    
    var (
    	nameRegex   = regexp.MustCompile(`^[a-z0-9()_-]{3,}$`)
    	sha256Regex = regexp.MustCompile(`\b[A-Fa-f0-9]{64}\b`)
    	secretRegex = regexp.MustCompile(`\b[A-Za-z]{64}\b`)
    	urlRegex    = regexp.MustCompile(`(\b(https?|ftp)://)?[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]`)
    )
    
    var (
    	// AlreadyExists is returned when store already exists.
    	AlreadyExists = errors.New("store path already exists")
    )
    
    func (s *Store) MatchName(subject string) bool {
    	return nameRegex.MatchString(subject)
    }