25+ results for 'regex uuid lang:go' (0 ms)

Not the results you expected?

types.go (git://github.com/eclark/exl.git) Go · 550 lines

28 TimeType

29 NullType

30 RegexType

31 dbPointerType

32 CodeType

46 FunctionType

47 OldBinaryType

48 UUIDType

49 MD5Type BinSubtype = 5

50 UserType BinSubtype = 0x80

339 }

340

341 type Regex struct {

342 Pattern string

343 Options string

user_event.go (https://github.com/backstage/backstage.git) Go · 265 lines

3 import (

4 "fmt"

5 "regexp"

6

7 "github.com/hashicorp/consul/consul/structs"

8 "github.com/hashicorp/go-uuid"

9 )

10

81 // Format message

82 var err error

83 if params.ID, err = uuid.GenerateUUID(); err != nil {

84 return fmt.Errorf("UUID generation failed: %v", err)

162 }

163

164 var tagRe *regexp.Regexp

165 if msg.TagFilter != "" {

166 re, err := regexp.Compile(msg.TagFilter)

uuid.go (git://github.com/nu7hatch/gouuid.git) Go · 173 lines

53 // uuid.ParseHex("{6ba7b814-9dad-11d1-80b4-00c04fd430c8}")

54 // uuid.ParseHex("urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8")

55 //

56 func ParseHex(s string) (u *UUID, err error) {

76 return

77 }

78 u = new(UUID)

79 copy(u[:], b)

80 return

83 // Generate a UUID based on the MD5 hash of a namespace identifier

84 // and a name.

85 func NewV3(ns *UUID, name []byte) (u *UUID, err error) {

86 if ns == nil {

87 err = errors.New("Invalid namespace UUID")

111 // Generate a UUID based on the SHA-1 hash of a namespace identifier

112 // and a name.

113 func NewV5(ns *UUID, name []byte) (u *UUID, err error) {

114 u = new(UUID)

uuid_test.go (git://github.com/nu7hatch/gouuid.git) Go · 135 lines

1 // This package provides immutable UUID structs and the functions

2 // NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4

3 // and 5 UUIDs as specified in RFC 4122.

4 //

5 // Copyright (C) 2011 by Krzysztof Kowalik <chris@nu7hat.ch>

6 package uuid

7

8 import (

9 "regexp"

10 "testing"

11 )

16 _, err := Parse([]byte{1, 2, 3, 4, 5})

17 if err == nil {

18 t.Errorf("Expected error due to invalid UUID sequence")

19 }

20 base, _ := NewV4()

ssl.go (https://gitlab.com/convox/rack.git) Go · 222 lines

5 "encoding/pem"

6 "fmt"

7 "regexp"

8 "strconv"

9 "strings"

38 // Find stack Parameters like WebPort443Certificate with an ARN set for the value

39 // Get and decode corresponding certificate info

40 re := regexp.MustCompile(`(\w+)Port(\d+)Certificate`)

41

42 for k, v := range app.Parameters {

131

132 if strings.HasPrefix(id, "acm-") {

133 uuid := id[4:]

134

135 res, err := ACM().ListCertificates(nil)

helper.go (https://bitbucket.org/logicielsolutions/lpm.git) Go · 152 lines

132 }

133

134 // isUUID check the provided string is valid UUID or not

135 func isUUID(str string) bool {

145 func isUUID4(str string) bool {

146 return regexUUID4.MatchString(str)

147 }

148

149 // isUUID5 check the provided string is valid UUID version 5 or not

150 func isUUID5(str string) bool {

151 return regexUUID5.MatchString(str)

152 }

153

prepared_query.go (https://github.com/backstage/backstage.git) Go · 252 lines

59 Type string

60

61 // Regexp is an optional regular expression to use to parse the full

62 // name, once the prefix match has selected a template. This can be

63 // used to extract parts of the name and choose a service name, set

64 // tags, etc.

65 Regexp string

66 }

67

69 // maintain in the state store.

70 type PreparedQuery struct {

71 // ID is this UUID-based ID for the query, always generated by Consul.

72 ID string

73

list_test.go (https://github.com/dotcloud/docker.git) Go · 144 lines

11 "github.com/docker/docker/container"

12 "github.com/docker/docker/image"

13 "github.com/google/uuid"

14 digest "github.com/opencontainers/go-digest"

15 "gotest.tools/v3/assert"

36 t.Helper()

37 var (

38 id = uuid.New().String()

39 computedImageID = digest.FromString(id)

40 cRoot = filepath.Join(root, id)

108 )

109

110 // moby/moby #37453 - ^ regex not working due to prefix slash

111 // not being stripped

112 containerList, err := d.Containers(&types.ContainerListOptions{

formatToStructFieldName.go (https://bitbucket.org/B-Core/file-server.git) Go · 36 lines

2

3 import (

4 "regexp"

5 "strings"

6 "unicode"

9 var regID = regexp.MustCompile("^(?i)id$")

10 var regUUID = regexp.MustCompile("^(?i)uuid$")

11 var regCSS = regexp.MustCompile("^(?i)css$")

30 sOut := string(out)

31

32 if regID.MatchString(sOut) || regUUID.MatchString(sOut) || regCSS.MatchString(sOut) {

33 sOut = strings.ToUpper(sOut)

34 }

gobits_test.go (https://gitlab.com/magan/gobits.git) Go · 273 lines

5 "os"

6 "path"

7 "regexp"

8 "testing"

9 )

33 input: &Config{Allowed: []string{"?"}},

34 output: &Config{},

35 errorMatch: "^failed to compile regexp .*",

36 },

37 {

39 input: &Config{Disallowed: []string{"?"}},

40 output: &Config{},

41 errorMatch: "^failed to compile regexp .*",

42 },

43 }

172 const uuid = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"

173

174 if b, _ := regexp.Match(uuid, []byte(n)); !b {

175 t.Errorf("invalid uuid! got %v", n)

util_test.go (https://github.com/backstage/backstage.git) Go · 327 lines

5 "fmt"

6 "net"

7 "regexp"

8 "testing"

9

218 }

219

220 func TestGenerateUUID(t *testing.T) {

221 prev := generateUUID()

222 for i := 0; i < 100; i++ {

223 id := generateUUID()

224 if prev == id {

225 t.Fatalf("Should get a new ID!")

226 }

227

228 matched, err := regexp.MatchString(

229 "[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}", id)

230 if !matched || err != nil {

id.go (https://bitbucket.org/kamilsk/click.git) Go · 24 lines

1 package types

2

3 import "regexp"

4

5 // [4] means that supported only v4.

6 var uuid = regexp.MustCompile(`(?i:^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$)`)

7

8 // ID wraps built-in `string` type and provides useful methods above it.

16 // IsValid returns true if the ID is not empty and compatible with RFC 4122.

17 func (id ID) IsValid() bool {

18 return !id.IsEmpty() && uuid.MatchString(string(id))

19 }

20

regexes.go (https://bitbucket.org/dzaycevteam/server.git) Go · 59 lines

39 hexcolorRegex = regexp.MustCompile(hexcolorRegexString)

40 rgbRegex = regexp.MustCompile(rgbRegexString)

41 rgbaRegex = regexp.MustCompile(rgbaRegexString)

44 emailRegex = regexp.MustCompile(emailRegexString)

45 base64Regex = regexp.MustCompile(base64RegexString)

46 iSBN10Regex = regexp.MustCompile(iSBN10RegexString)

47 iSBN13Regex = regexp.MustCompile(iSBN13RegexString)

48 uUID3Regex = regexp.MustCompile(uUID3RegexString)

49 uUID4Regex = regexp.MustCompile(uUID4RegexString)

50 uUID5Regex = regexp.MustCompile(uUID5RegexString)

51 uUIDRegex = regexp.MustCompile(uUIDRegexString)

52 aSCIIRegex = regexp.MustCompile(aSCIIRegexString)

53 printableASCIIRegex = regexp.MustCompile(printableASCIIRegexString)

54 multibyteRegex = regexp.MustCompile(multibyteRegexString)

uuid.go (https://bitbucket.org/kamilsk/passport.git) Go · 24 lines

1 package domain

2

3 import "regexp"

4

5 // [4] means that supported only v4.

6 var uuid = regexp.MustCompile(`(?i:^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$)`)

7

8 // UUID wraps built-in `string` type and provides useful methods above it.

9 type UUID string

10

11 // IsEmpty returns true if the UUID has empty value.

12 func (s UUID) IsEmpty() bool {

13 return s == ""

14 }

id.go (https://bitbucket.org/kamilsk/click.git) Go · 24 lines

1 package domain

2

3 import "regexp"

4

5 // [4] means that supported only v4.

6 var uuid = regexp.MustCompile(`(?i:^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$)`)

7

8 // ID wraps built-in `string` type and provides useful methods above it.

16 // IsValid returns true if the ID is not empty and compatible with RFC 4122.

17 func (s ID) IsValid() bool {

18 return !(s == "") && uuid.MatchString(string(s)) // IsEmpty and String were inlined manually

19 }

20

resources.go (https://gitlab.com/biopandemic/terraform.git) Go · 147 lines

4 "fmt"

5 "log"

6 "regexp"

7 "time"

8

120 }

121

122 // ID can be either a UUID or a UnlimitedResourceID

123 func isID(id string) bool {

124 re := regexp.MustCompile(`^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-1)$`)

prepared_query.go (https://github.com/backstage/backstage.git) Go · 193 lines

52 Type string

53

54 // Regexp allows specifying a regex pattern to match against the name

55 // of the query being executed.

56 Regexp string

59 // PrepatedQueryDefinition defines a complete prepared query.

60 type PreparedQueryDefinition struct {

61 // ID is this UUID-based ID for the query, always generated by Consul.

62 ID string

63

string.go (https://bitbucket.org/behmaroman/ro_be.git) Go · 42 lines

5 "crypto/rand"

6 "io"

7 "github.com/google/uuid"

8 "fmt"

9 "crypto/md5"

11

12 const (

13 EmailRegexp = `^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`

14 )

15

22 }

23

24 func UUID() string {

25 return uuid.New().String()

resources.go (https://gitlab.com/displague/terraform.git) Go · 137 lines

21 }

22

23 func setValueOrUUID(d *schema.ResourceData, key string, value string, uuid string) {

24 if isUUID(d.Get(key).(string)) {

29 }

30

31 func retrieveUUID(cs *cloudstack.CloudStackClient, name, value string) (uuid string, e *retrieveError) {

32 // If the supplied value isn't a UUID, try to retrieve the UUID ourselves

54 uuid, err = cs.Network.GetNetworkID(value)

55 case "zone":

56 uuid, err = cs.Zone.GetZoneID(value)

57 case "ipaddress":

58 p := cs.Address.NewListPublicIpAddressesParams()

97 func retrieveTemplateUUID(cs *cloudstack.CloudStackClient, zoneid, value string) (uuid string, e *retrieveError) {

98 // If the supplied value isn't a UUID, try to retrieve the UUID ourselves

99 if isUUID(value) {

uuid.go (https://bitbucket.org/agallego/uuid.git) Go · 78 lines

25 // |octets 10 - 15| - node: The spatially unique node identifier.

26 //

27 type UUID [16]byte

28

29

34 //

35 // where x is any hexadecimal digit and y is one of 8, 9, A, or B.

36 func (id *UUID) String() string {

37 return fmt.Sprintf("%x-%x-%x-%x-%x", id[:4], id[4:6], id[6:8], id[8:10], id[10:])

38 }

43

44

45 func Equal(lhs *UUID, rhs *UUID) bool {

46 return bytes.Equal(lhs[:], rhs[:])

47 }

73

74 func ValidString(s string) bool{

75 regex := regexp.MustCompile(`^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$`)

76 return regex.MatchString(s)

user.go (https://gitlab.com/wiliamsouza/apollo.git) Go · 111 lines

4 "encoding/base64"

5 "errors"

6 "regexp"

7 "time"

8

9 "code.google.com/p/go-uuid/uuid"

10 "code.google.com/p/go.crypto/bcrypt"

11 "labix.org/v2/mgo/bson"

26 // ValidateEmail check if email is valid

27 func (u *User) ValidateEmail() (bool, error) {

28 m, err := regexp.Match(`^[^@]+@[^@]+\.[^@]+$`, []byte(u.Email))

29 if err != nil {

30 panic(err)

server.go (https://bitbucket.org/kisom/ssdpflood.git) Go · 128 lines

8 "net"

9 "os"

10 "regexp"

11 "time"

12 )

17 SERVER: (null)\r

18 ST:blahblahblah

19 USN:uuid:UPnP-blah::urn:schemas-upnp-org:service:BLAHFOO:1\r

20 `

21

89

90 fmt.Println("[+] SSDP packet from", addr)

91 if match, err := regexp.Match("^M-SEARCH \\*", msg); err != nil {

92 fmt.Println("[!] regexp error: ", err.Error())

uuid_test.go (https://bitbucket.org/kisom/uuid.git) Go · 49 lines

1 package uuid

2

3 import (

11 var uuidV4RegexStr = fmt.Sprintf("^%s{8}-%s{4}-4%s{3}-[89AB]%s{3}-%s{12}$",

12 hexOctet, hexOctet, hexOctet, hexOctet, hexOctet)

13 var uuidVersion4Regex = regexp.MustCompile(uuidV4RegexStr)

14

15 func TestGenerateV4(t *testing.T) {

24 fmt.Printf("[!] UUID length mismatch: %s\n", u)

25 t.FailNow()

26 } else if !uuidVersion4Regex.Match(u) {

27 fmt.Printf("[!] invalid UUID: %s\n", u)

42 fmt.Printf("[!] UUID length mismatch: %s\n", u)

43 t.FailNow()

44 } else if !uuidVersion4Regex.MatchString(u) {

45 fmt.Printf("[!] invalid UUID: %s\n", u)

fingerprint.go (https://bitbucket.org/kamilsk/passport.git) Go · 18 lines

1 package domain

2

3 import "regexp"

4

5 var fingerprint = regexp.MustCompile(`(?i:^[0-9A-F]{32,64}$)`)

8 type Fingerprint struct {

9 ID int64

10 Session UUID

11 Marker string

12 CreatedAt string

uuid_test.go (https://bitbucket.org/agallego/uuid.git) Go · 15 lines

1 package uuid

2

3 import (

8 func TestUUIDV4(t *testing.T) {

9 fmt.Println("Testing UUID.V4 against regex")

10 str := V4().String()

11 if !ValidString(str) {

12 t.Fatalf("Failed to validate uuid string")

13 }

14 }