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

Not the results you expected?

rfc4122_test.go (https://gitlab.com/github-cloud-corp/amazon-ssm-agent) Go · 209 lines

29 }

30 if !parseUUIDRegex.MatchString(u.String()) {

31 t.Errorf("Expected string representation to be valid, given: %s", u.String())

49 }

50 if !parseUUIDRegex.MatchString(u.String()) {

51 t.Errorf("Expected string representation to be valid, given: %s", u.String())

69 if Equal(u4, u) {

70 t.Errorf("Expected UUIDs generated with the same namespace and different names to be different but got: %s and %s", u4, u)

71 }

97 }

98 if !parseUUIDRegex.MatchString(u.String()) {

99 t.Errorf("Expected string representation to be valid, given: %s", u.String())

117 }

118 if !parseUUIDRegex.MatchString(u.String()) {

119 t.Errorf("Expected string representation to be valid, given: %s", u.String())

results.go (https://gitlab.com/Red54/machine) Go · 316 lines

59 Name string `mapstructure:"name" json:"name"`

60 // Specifies the request URL this rule should match for this origin to be used. Regex is supported.

61 RequestURL string `mapstructure:"request_url" json:"request_url"`

124 Name string `mapstructure:"name" json:"name"`

125 // Specifies the request URL this rule should match for this TTL to be used. Regex is supported.

126 RequestURL string `mapstructure:"request_url" json:"request_url"`

203 // Specifies the service ID that represents distributed content. The value is

204 // a UUID, such as 96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0, that is generated by the server.

205 ID string `mapstructure:"id"`

validation.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 163 lines

4 "fmt"

5 "regexp"

6

14

15 var ParameterNameRegexp = regexp.MustCompile(`^[a-zA-Z0-9_]+$`)

16

22 }

23 if !ParameterNameRegexp.MatchString(param.Name) {

24 allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), param.Name, fmt.Sprintf("does not match %v", ParameterNameRegexp)))

129

130 var uuidRegex = regexp.MustCompile("^(?i)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")

131

132 func nameIsUUID(name string, prefix bool) []string {

133 if uuidRegex.MatchString(name) {

134 return nil

operators_test.go (https://bitbucket.org/asardak/atm-store.git) Go · 231 lines

69 {"NotIn", NotIn(f("name"), "Joe", "Jane"), 1},

70 {"MatchRegexCase upper", MatchRegexCase(f("name"), "J.*"), 2},

71 {"MatchRegexCase lower", MatchRegexCase(f("name"), "j.*"), 0},

72 {"MatchRegex upper", MatchRegex(f("name"), "J.*"), 2},

73 {"MatchRegex lower", MatchRegex(f("name"), "j.*"), 2},

74 {"NotMatchRegexCase upper", NotMatchRegexCase(f("name"), "J.*"), 1},

75 {"NotMatchRegexCase lower", NotMatchRegexCase(f("name"), "j.*"), 3},

76 {"NotMatchRegex upper", NotMatchRegex(f("name"), "J.*"), 1},

77 {"NotMatchRegex lower", NotMatchRegex(f("name"), "j.*"), 1},

93 s.create(`CREATE TABLE slices (

94 id uuid PRIMARY KEY,

95 elems bigint[]

gatt_tool_test.go (https://gitlab.com/brucealdridge/driver-go-blecombined) Go · 42 lines

11

12 func TestCharacteristicsRegex(t *testing.T) {

13 line := "handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb"

25 if params["uuid"] != "00002a00-0000-1000-8000-00805f9b34fb" {

26 t.Errorf("bad characteristic uuid %v", params["uuid"])

27 }

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

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

13 "github.com/google/uuid"

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

37 var (

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

39 computedImageID = digest.FromString(id)

109

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

111 // not being stripped

message_matcher.go (https://gitlab.com/karouf/heka) Go · 245 lines

72 switch stmt.field.tokenId {

73 case VAR_UUID:

74 return msg.GetUuidString()

124 case OP_RE:

125 if stmt.value.regexp != nil {

126 return stmt.value.regexp.MatchString(s)

132 case OP_NRE:

133 if stmt.value.regexp != nil {

134 return !stmt.value.regexp.MatchString(s)

182 switch stmt.field.tokenId {

183 case VAR_UUID, VAR_TYPE, VAR_LOGGER, VAR_PAYLOAD,

184 VAR_ENVVERSION, VAR_HOSTNAME:

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

29 NullType

30 RegexType

31 dbPointerType

47 OldBinaryType

48 UUIDType

49 MD5Type BinSubtype = 5

340

341 type Regex struct {

342 Pattern string

345

346 func (re *Regex) WriteTo(w io.Writer) (n int64, err os.Error) {

347 return write(w, []byte(re.Pattern), byte(0), []byte(re.Options), byte(0))

349

350 func (re *Regex) ReadFrom(r io.Reader) (n int64, err os.Error) {

351 var v byte

legacy_deployment_state_migrator.go (https://gitlab.com/JamesClonk/bosh-init) Go · 168 lines

11 boshsys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system"

12 boshuuid "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/uuid"

13 )

21 fs boshsys.FileSystem

22 uuidGenerator boshuuid.Generator

23 logger boshlog.Logger

29 fs boshsys.FileSystem,

30 uuidGenerator boshuuid.Generator,

31 logger boshlog.Logger,

35 fs: fs,

36 uuidGenerator: uuidGenerator,

37 logger: logger,

89 } else {

90 uuid, err := m.uuidGenerator.Generate()

91 if err != nil {

sysinfo.go (https://gitlab.com/unofficial-mirrors/kubernetes) Go · 203 lines

18 "fmt"

19 "regexp"

20 "strconv"

26

27 var schedulerRegExp = regexp.MustCompile(`.*\[(.*)\].*`)

28

70 if err == nil {

71 matches := schedulerRegExp.FindSubmatch([]byte(blkSched))

72 if len(matches) >= 2 {

200

201 func GetSystemUUID(sysFs sysfs.SysFs) (string, error) {

202 return sysFs.GetSystemUUID()

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

4 "fmt"

5 "regexp"

6

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

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

9 )

56 if params.NodeFilter != "" {

57 if _, err := regexp.Compile(params.NodeFilter); err != nil {

58 return fmt.Errorf("Invalid node filter: %v", err)

82 var err error

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

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

163

164 var tagRe *regexp.Regexp

165 if msg.TagFilter != "" {

uuid_test.go (https://gitlab.com/aviz/go-uuid) Go · 158 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

9 "fmt"

10 "regexp"

11 "testing"

18 if err == nil {

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

20 }

23 if err != nil {

24 t.Errorf("Expected to parse UUID sequence without problems")

25 return

gatt_tool.go (https://gitlab.com/brucealdridge/driver-go-blecombined) Go · 162 lines

11 "os/exec"

12 "regexp"

13 "strings"

20 log = loggo.GetLogger("bluez")

21 charRegex = regexp.MustCompile("handle = (?P<handle>[0-9a-fx]+), char properties = (?P<char_props>[0-9a-fx]+), char value handle = (?P<char_value_handle>[0-9a-fx]+), uuid = (?P<uuid>[0-9a-f-]+)")

22 readRegex = regexp.MustCompile(`Characteristic value\/descriptor: ([0-9a-f ]+)`)

40 type Characteristic struct {

41 UUID string

42 Handle string // use this to READ

62 c := &Characteristic{

63 UUID: params["uuid"],

64 Handle: params["handle"],

135

136 matches := charRegex.FindAllStringSubmatch(line, -1)

137

fuse_gtest_files.py (https://bitbucket.org/ultra_iter/qt-vtl.git) Python · 250 lines

69

70 # Regex for matching '#include <gtest/...>'.

71 INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*<(gtest/.+)>')

72

73 # Regex for matching '#include "src/..."'.

74 INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"')

162 for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):

163 m = INCLUDE_GTEST_FILE_REGEX.match(line)

164 if m:

190 for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):

191 m = INCLUDE_GTEST_FILE_REGEX.match(line)

192 if m:

207 else:

208 m = INCLUDE_SRC_FILE_REGEX.match(line)

209 if m:

message_template.go (https://gitlab.com/karouf/heka) Go · 116 lines

27

28 // Populated by the init function, this regex matches the MessageFields values

29 // to interpolate variables from capture groups or other parts of the existing

30 // message.

31 var varMatcher *regexp.Regexp

32

69 msg.SetSeverity(int32(severity))

70 case "Uuid":

71 if len(val) == message.UUID_SIZE {

73 } else {

74 if uuidBytes := uuid.Parse(val); uuidBytes == nil {

75 return errors.New("Invalid UUID string.")

76 } else {

77 msg.SetUuid(uuidBytes)

78 }

rkt_list_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 182 lines

54 cmd := fmt.Sprintf("%s --insecure-options=image prepare %s", ctx.Cmd(), imgID.path)

55 podUuid := runRktAndGetUUID(t, cmd)

56

65 }{

66 // Test that pod UUID is in output

67 {

69 true,

70 podUuid,

71 },

119 match := fmt.Sprintf(".*%s\t.*\t(.*)\t(.*)\t", imageID)

120 result, out, err := expectRegexWithOutput(child, match)

121 if err != nil {

152 cmd := fmt.Sprintf("%s --insecure-options=image prepare %s", ctx.Cmd(), imgID.path)

153 podUuid := runRktAndGetUUID(t, cmd)

154

rkt_export_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 169 lines

137 t.Logf("Preparing 'inspect --write-file'")

138 uuid := runRktAndGetUUID(t, prepareCmd)

139

140 runCmd := fmt.Sprintf("%s run-prepared %s", ctx.Cmd(), uuid)

141 t.Logf("Running 'inspect --write-file'")

145 if ct.unmountOverlay {

146 unmountPod(t, ctx, uuid, true)

147 }

149 // Export the image

150 exportCmd := fmt.Sprintf("%s export %s %s %s", ctx.Cmd(), ct.exportArgs, uuid, tmpTestAci)

151 t.Logf("Running 'export'")

159 if ct.expectedResult != "" {

160 if _, out, err := expectRegexWithOutput(child, ct.expectedResult); err != nil {

161 t.Fatalf("expected %q but not found: %v\n%s", ct.expectedResult, err, out)

autohotkey.vim (https://bitbucket.org/ultra_iter/vim-qt.git) Vim Script · 292 lines

167 syn keyword autohotkeyFunction

168 \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr

169 \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage

downward_api_test.go (https://gitlab.com/admin-github-cloud/bootkube) Go · 164 lines

34 It("should provide pod name and namespace as env vars [Conformance]", func() {

35 podName := "downward-api-" + string(util.NewUUID())

36 env := []api.EnvVar{

65 It("should provide pod IP as an env var", func() {

66 podName := "downward-api-" + string(util.NewUUID())

67 env := []api.EnvVar{

86 It("should provide container's limits.cpu/memory and requests.cpu/memory as env vars", func() {

87 podName := "downward-api-" + string(util.NewUUID())

88 env := []api.EnvVar{

162

163 f.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations)

164 }

uuid.go (https://gitlab.com/JamesClonk/bosh-init) Go · 173 lines

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

6 package uuid

7

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

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

55 //

77 }

78 u = new(UUID)

79 copy(u[:], b)

84 // and a name.

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

86 if ns == nil {

112 // and a name.

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

114 u = new(UUID)

vbm.go (https://gitlab.com/JamesClonk/machine) Go · 90 lines

9 "path/filepath"

10 "regexp"

11 "runtime"

17 var (

18 reVMNameUUID = regexp.MustCompile(`"(.+)" {([0-9a-f-]+)}`)

19 reVMInfoLine = regexp.MustCompile(`(?:"(.+)"|(.+))=(?:"(.*)"|(.*))`)

20 reColonLine = regexp.MustCompile(`(.+):\s+(.*)`)

21 reMachineNotFound = regexp.MustCompile(`Could not find a registered machine named '(.+)'`)

data.go (https://bitbucket.org/nexneo/samay.git) Go · 254 lines

6 "os"

7 "regexp"

8 "sort"

172

173 tagsFinder := regexp.MustCompile("\\B#(\\w\\w+)")

174 for _, v := range tagsFinder.FindAllStringSubmatch(content, 20) {

184 }

185 id, _ := util.UUID()

186 e.Id = proto.String(id)

uuid_test.go (https://gitlab.com/JamesClonk/bosh-init) 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"

17 if err == nil {

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

19 }

22 if err != nil {

23 t.Errorf("Expected to parse UUID sequence without problems")

24 return

qdeclarativejsastfwd_p.h (https://bitbucket.org/ultra_iter/qt-vtl.git) C Header · 189 lines

95 class StringLiteral;

96 class RegExpLiteral;

97 class ArrayLiteral;

results.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 304 lines

57 Name string `json:"name" required:"true"`

58 // Specifies the request URL this rule should match for this origin to be used. Regex is supported.

59 RequestURL string `json:"request_url" required:"true"`

122 Name string `json:"name" required:"true"`

123 // Specifies the request URL this rule should match for this TTL to be used. Regex is supported.

124 RequestURL string `json:"request_url" required:"true"`

201 // Specifies the service ID that represents distributed content. The value is

202 // a UUID, such as 96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0, that is generated by the server.

203 ID string `json:"id"`

rkt_gc_test.go (https://gitlab.com/github-cloud-corporation/rkt) Go · 120 lines

97 cmd := fmt.Sprintf("%s --insecure-options=image prepare %s", ctx.Cmd(), imagePath)

98 uuid := runRktAndGetUUID(t, cmd)

99

100 cmd = fmt.Sprintf("%s run-prepared %s", ctx.Cmd(), uuid)

101 runRktAndCheckOutput(t, cmd, "", false)

102

103 unmountPod(t, ctx, uuid, rmNetns)

104

111 // check we don't get any output (an error) after "executing net-plugin..."

112 runRktAndCheckRegexOutput(t, gcCmd, `executing net-plugin .*\n\z`)

113

workspacerouter.go (https://gitlab.com/geropl/gitpod) Go · 196 lines

45 return func(r *mux.Router, wsInfoProvider WorkspaceInfoProvider) (*mux.Router, *mux.Router, *mux.Router) {

46 allClusterWsHostSuffixRegex := wsHostSuffixRegex

47 if allClusterWsHostSuffixRegex == "" {

77 func matchWorkspaceHostHeader(wsHostSuffix string, headerProvider hostHeaderProvider, matchPort bool) mux.MatcherFunc {

78 regexPrefix := workspaceIDRegex

79 if matchPort {

80 regexPrefix = workspacePortRegex + workspaceIDRegex

81 }

82

83 r := regexp.MustCompile("^" + regexPrefix + wsHostSuffix)

84 foreignContentHostR := regexp.MustCompile("^(.+)(?:foreign)" + wsHostSuffix)

85 foreignContentHost2R := regexp.MustCompile("^((?:v--)?[0-9a-v]+)" + wsHostSuffix)

86 foreignContentPathR := regexp.MustCompile("^/" + regexPrefix + "(/.*)")

87 return func(req *http.Request, m *mux.RouteMatch) bool {

regress-307456.js (https://bitbucket.org/ultra_iter/qt-vtl.git) JavaScript · 54 lines

40 var BUGNUMBER = 307456;

41 var summary = 'Do not Freeze with RegExp';

42 var actual = 'No Crash';

50 printStatus(data);

51 data=data.replace(RegExp('<!--(\\n[^\\n]|[^-]|-[^-]|--[^>])*-->', 'g'), '');

52 printStatus(data);

requests.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 164 lines

4 "net"

5 "regexp"

6 "strings"

48

49 uuidRegex, _ := regexp.Compile("^[a-z0-9]{8}-[a-z0-9]{4}-[1-5][a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}$")

50

51 if opts.Group != "" {

52 if !uuidRegex.MatchString(opts.Group) {

53 err := gophercloud.ErrInvalidInput{}

63 for _, diffHost := range opts.DifferentHost {

64 if !uuidRegex.MatchString(diffHost) {

65 err := gophercloud.ErrInvalidInput{}

76 for _, sameHost := range opts.SameHost {

77 if !uuidRegex.MatchString(sameHost) {

78 err := gophercloud.ErrInvalidInput{}

QtOpenGL.4.1.0.win32-gcc-ia32.txt (https://bitbucket.org/ultra_iter/qt-vtl.git) Plain Text · 17675 lines

310

311 Class QRegExp

312 size=4 align=4

313 base size=4 base align=4

314 QRegExp (0xeac380) 0

315

qdeclarativejsparser.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 1904 lines

607 case 78: {

608 bool rx = lexer->scanRegExp(Lexer::NoPrefix);

609 if (!rx) {

615

616 AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);

617 node->literalToken = loc(1);

621 case 79: {

622 bool rx = lexer->scanRegExp(Lexer::EqualPrefix);

623 if (!rx) {

629

630 AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);

631 node->literalToken = loc(1);

rkt_exec_test.go (https://gitlab.com/github-cloud-corporation/rkt) Go · 98 lines

46 rktCmd string

47 expectedRegex string

48 }{

51 rktCmd: fmt.Sprintf("%s --insecure-options=image run --mds-register=false %s -- --print-exec", ctx.Cmd(), execImage),

52 expectedRegex: "inspect execed as: /inspect",

53 },

70 } {

71 runRktAndCheckRegexOutput(t, tt.rktCmd, tt.expectedRegex)

72 }

84 rktCmd = fmt.Sprintf("%s prepare --insecure-options=image %s -- --print-exec", ctx.Cmd(), execImage)

85 uuid = runRktAndGetUUID(t, rktCmd)

86

92 rktCmd = fmt.Sprintf("%s prepare --insecure-options=image %s --exec /inspect-link -- --print-exec", ctx.Cmd(), execImage)

93 uuid = runRktAndGetUUID(t, rktCmd)

94

regexes.go (https://gitlab.com/kingwill101/palaceapi) 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)

downward_api.go (https://gitlab.com/0072016/Facebook-php) Go · 211 lines

33 It("should provide pod name and namespace as env vars [Conformance]", func() {

34 podName := "downward-api-" + string(util.NewUUID())

35 env := []api.EnvVar{

64 It("should provide pod IP as an env var", func() {

65 podName := "downward-api-" + string(util.NewUUID())

66 env := []api.EnvVar{

85 It("should provide container's limits.cpu/memory and requests.cpu/memory as env vars", func() {

86 podName := "downward-api-" + string(util.NewUUID())

87 env := []api.EnvVar{

131 It("should provide default limits.cpu/memory from node capacity", func() {

132 podName := "downward-api-" + string(util.NewUUID())

133 env := []api.EnvVar{

209 func testDownwardAPIUsingPod(f *framework.Framework, pod *api.Pod, env []api.EnvVar, expectations []string) {

210 f.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations)

211 }

GitRepositoryReader.java (https://bitbucket.org/nbargnesi/idea.git) Java · 510 lines

41 import java.util.concurrent.atomic.AtomicReference;

42 import java.util.regex.Matcher;

43 import java.util.regex.Pattern;

376 String headContent = tryLoadFile(myHeadFile, calcEncoding(myHeadFile));

377 headContent = headContent.trim(); // remove possible leading and trailing spaces to clearly match regexps

378

downward_api.go (https://gitlab.com/github-cloud-corporation/kubernetes) Go · 211 lines

23 "k8s.io/kubernetes/pkg/api/resource"

24 "k8s.io/kubernetes/pkg/util/uuid"

25 "k8s.io/kubernetes/test/e2e/framework"

33 It("should provide pod name and namespace as env vars [Conformance]", func() {

34 podName := "downward-api-" + string(uuid.NewUUID())

35 env := []api.EnvVar{

64 It("should provide pod IP as an env var", func() {

65 podName := "downward-api-" + string(uuid.NewUUID())

66 env := []api.EnvVar{

85 It("should provide container's limits.cpu/memory and requests.cpu/memory as env vars", func() {

86 podName := "downward-api-" + string(uuid.NewUUID())

87 env := []api.EnvVar{

131 It("should provide default limits.cpu/memory from node capacity", func() {

132 podName := "downward-api-" + string(uuid.NewUUID())

133 env := []api.EnvVar{

sysinfo.go (https://gitlab.com/leetchang/kubernetes) Go · 210 lines

18 "fmt"

19 "regexp"

20 "strconv"

26

27 var schedulerRegExp = regexp.MustCompile(".*\\[(.*)\\].*")

28

71 } else {

72 matches := schedulerRegExp.FindSubmatch([]byte(sched))

73 if len(matches) < 2 {

207

208 func GetSystemUUID(sysFs sysfs.SysFs) (string, error) {

209 return sysFs.GetSystemUUID()

rkt_cat_manifest_test.go (https://gitlab.com/github-cloud-corporation/rkt) Go · 70 lines

41 cmd := fmt.Sprintf("%s --insecure-options=image prepare %s", ctx.Cmd(), imgID.path)

42 podUuid := runRktAndGetUUID(t, cmd)

43

47 tests := []struct {

48 uuid string

49 match string

51 {

52 podUuid,

53 imgName,

55 {

56 podUuid,

57 imageHash[:20],

65 for i, tt := range tests {

66 runCmd := fmt.Sprintf("%s cat-manifest --pretty-print=false %s", ctx.Cmd(), tt.uuid)

67 t.Logf("Running test #%d", i)

FlowerPowerDriver.go (https://gitlab.com/brucealdridge/driver-go-sensortag) Go · 139 lines

5 "os/exec"

6 "regexp"

7 "strings"

58 // log.Infof("found device %s", device.Address)

59 for uuid, _ := range device.Advertisement.ServiceUuids {

60 if uuid == flowerPowerServiceUuid {

101 }

102 re := regexp.MustCompile("([0-9A-F]{2}\\:{0,1}){6}")

103 mac := strings.Replace(re.FindString(string(out)), ":", "", -1)

main.go (https://gitlab.com/brucealdridge/driver-go-blecombined) Go · 122 lines

7 "os/signal"

8 "regexp"

9 "strings"

36 }

37 re := regexp.MustCompile("([0-9A-F]{2}\\:{0,1}){6}")

38 mac := strings.Replace(re.FindString(string(out)), ":", "", -1)

97

98 for uuid := range device.Advertisement.ServiceUuids {

99 if uuid == flowerPowerServiceUuid {

111 // look for tags which are CLOSE to the sphere!!

112 for uuid := range device.Advertisement.ServiceUuids {

113 if uuid == stickNFindServiceUuid {

validation.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 45 lines

3 import (

4 "regexp"

5

10 func ValidateProvisionRequest(preq *ProvisionRequest) field.ErrorList {

11 errors := ValidateUUID(field.NewPath("service_id"), preq.ServiceID)

12 errors = append(errors, ValidateUUID(field.NewPath("plan_id"), preq.PlanID)...)

37

38 var uuidRegex = regexp.MustCompile("^(?i)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")

39

40 func ValidateUUID(path *field.Path, uuid string) field.ErrorList {

41 if uuidRegex.MatchString(uuid) {

42 return nil

43 }

44 return field.ErrorList{field.Invalid(path, uuid, "must be a valid UUID")}

45 }

downward_api_test.go (https://gitlab.com/0072016/Facebook-php) Go · 165 lines

34 It("should provide pod name and namespace as env vars [Conformance]", func() {

35 podName := "downward-api-" + string(util.NewUUID())

36 env := []api.EnvVar{

65 It("should provide pod IP as an env var", func() {

66 podName := "downward-api-" + string(util.NewUUID())

67 env := []api.EnvVar{

86 It("should provide container's limits.cpu/memory and requests.cpu/memory as env vars", func() {

87 podName := "downward-api-" + string(util.NewUUID())

88 env := []api.EnvVar{

160 }

161 // TODO(random-liu): Change TestContainerOutputRegexp to use PodClient and avoid MungeSpec explicitly

162 f.PodClient().MungeSpec(pod)

163

164 f.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations)

165 }

requests.go (https://gitlab.com/vectorci/kubernetes) Go · 134 lines

5 "net"

6 "regexp"

7 "strings"

45

46 uuidRegex, _ := regexp.Compile("^[a-z0-9]{8}-[a-z0-9]{4}-[1-5][a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}$")

47

48 if opts.Group != "" {

49 if !uuidRegex.MatchString(opts.Group) {

50 return nil, fmt.Errorf("Group must be a UUID")

56 for _, diffHost := range opts.DifferentHost {

57 if !uuidRegex.MatchString(diffHost) {

58 return nil, fmt.Errorf("The hosts in DifferentHost must be in UUID format.")

65 for _, sameHost := range opts.SameHost {

66 if !uuidRegex.MatchString(sameHost) {

67 return nil, fmt.Errorf("The hosts in SameHost must be in UUID format.")

regexes.go (https://gitlab.com/sheket/server) Go · 64 lines

33 var (

34 alphaRegex = regexp.MustCompile(alphaRegexString)

35 alphaNumericRegex = regexp.MustCompile(alphaNumericRegexString)

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)

60

61 func matchesRegex(regex *regexp.Regexp, field interface{}) bool {

62 fieldAsString := field.(string) //this will panic inherently

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

6 "fmt"

7 "regexp"

8 "strconv"

39 // Get and decode corresponding certificate info

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

41

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

133 uuid := id[4:]

134

143

144 if parts[len(parts)-1] == uuid {

145 res, err := ACM().DescribeCertificate(&acm.DescribeCertificateInput{

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

133

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

135 func isUUID(str string) bool {

143

144 // isUUID4 check the provided string is valid UUID version 4 or not

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 }

lsblk.go (https://gitlab.com/JamesClonk/cryptmount) Go · 199 lines

6 "reflect"

7 "regexp"

8 "strconv"

12 var (

13 LSBLK_CMD = `lsblk -f -a -p --pairs -n -b -o NAME,FSTYPE,MOUNTPOINT,LABEL,UUID,PARTLABEL,PARTUUID,SIZE,TYPE`

14 LSBLK_RX = regexp.MustCompile(`(\w+)=(?:"(.*?)")`)

42 Label string

43 Uuid string

44 Size string

54 Label string

55 Uuid string

56 Size string

downward_api.go (https://gitlab.com/jasonbishop/contrib) Go · 104 lines

31 It("should provide pod name and namespace as env vars [Conformance]", func() {

32 podName := "downward-api-" + string(util.NewUUID())

33 env := []api.EnvVar{

62 It("should provide pod IP as an env var", func() {

63 podName := "downward-api-" + string(util.NewUUID())

64 env := []api.EnvVar{

102

103 framework.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations)

104 }

uuid_v4_generator_test.go (https://gitlab.com/JamesClonk/bosh-init) Go · 26 lines

1 package uuid_test

2

3 import (

4 "regexp"

5

8

9 . "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/uuid"

10 )

17

18 uuid, err := generator.Generate()

19 Expect(err).ToNot(HaveOccurred())

21 uuidFormat := "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"

22 uuidRegexp, _ := regexp.Compile(uuidFormat)

23 Expect(uuidRegexp.MatchString(uuid)).To(BeTrue())

control_test.go (https://gitlab.com/maxraab/gitlab-runner) Go · 53 lines

10

11 func TestSnapshotNameRegex(t *testing.T) {

12 var tests = []struct {

18 {`SnapshotName="gitlabrunner"`, "gitlabrunner", true},

19 {"SnapshotName=\"gitlabrunner\"\nSnapshotUUID=\"UUID\"\n", "gitlabrunner", true},

20 {"SnapshotName=\"gitlabrunner\"\nSnapshotUUID=\"UUID\"\n", "notpresent", false},

21 // Windows style \r\n new lines

22 {"SnapshotName=\"gitlabrunner\"\r\nSnapshotUUID=\"UUID\"\r\n", "gitlabrunner", true},

23 }

36 {`CurrentSnapshotName="gitlabrunner"`, "gitlabrunner", true},

37 {"CurrentSnapshotName=\"gitlabrunner\"\nCurrentSnapshotUUID=\"UUID\"\n", "gitlabrunner", true},

38 {"CurrentSnapshotName=\"gitlabrunner\"\nCurrentSnapshotUUID=\"UUID\"\n", "notpresent", false},

39 // Windows style \r\n new lines

40 {"CurrentSnapshotName=\"gitlabrunner\"\r\nCurrentSnapshotUUID=\"UUID\"\r\n", "gitlabrunner", true},

41 }

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

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

64 // tags, etc.

65 Regexp string

66 }

70 type PreparedQuery struct {

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

72 ID string

validation.go (https://gitlab.com/unofficial-mirrors/kubernetes) Go · 74 lines

4 "errors"

5 "regexp"

6 )

18 // collection of restricted characters.

19 IDPattern = regexp.MustCompile(`^` + IDFormat + `$`)

20

22 // collection of restricted characters.

23 NamePattern = regexp.MustCompile(`^` + NameFormat + `$`)

24

30 func ValidateNamespaceAndRef(namespace, ref string) error {

31 if !IsUUID(ref) && !IsName(ref) {

32 return ErrNoRef

47

48 // IsUUID returns true if the string input is a valid UUID string.

49 func IsUUID(s string) bool {

volumes_linux.go (https://gitlab.com/rollbrettler/lachs) Go · 128 lines

7 "os/exec"

8 "regexp"

9 )

12 var execLookPath = exec.LookPath

13 var blockDeviceRegex = `(?P<path>.*):(\sSEC_TYPE=\"(.*)\")?(\sLABEL=\"(?P<label>.*)\")?\sUUID=\"(?P<uuid>.*)\"\sTYPE=\"(?P<type>\w*)\"(\sPARTUUID=\"(.*)\")?`

14

17 Path string `json:"path"`

18 UUID string `json:"uuid"`

19 Type string `json:"type"`

100 for scanner.Scan() {

101 blockDeviceRegexp, err := regexp.Compile(blockDeviceRegex)

102 if err != nil {

105

106 match := blockDeviceRegexp.FindStringSubmatch(scanner.Text())

107 v := Volume{}

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

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

13 "github.com/google/uuid"

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

37 var (

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

39 computedImageID = digest.FromString(id)

109

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

111 // not being stripped

label.go (https://gitlab.com/unofficial-mirrors/kubernetes) Go · 163 lines

21 "path"

22 "regexp"

23 "strings"

42 var (

43 labelRepoRegexp = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_]*$`)

44 labelPkgRegexp = regexp.MustCompile(`^[A-Za-z0-9/._-]*$`)

45 labelNameRegexp = regexp.MustCompile(`^[A-Za-z0-9_/.+=,@~-]*$`)

46 )

61 repo = s[len("@"):endRepo]

62 if !labelRepoRegexp.MatchString(repo) {

63 return NoLabel, fmt.Errorf("label parse error: repository has invalid characters: %q", origStr)

78 }

79 if !labelPkgRegexp.MatchString(pkg) {

80 return NoLabel, fmt.Errorf("label parse error: package has invalid characters: %q", origStr)

rkt_cat_manifest_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 95 lines

42 cmd := fmt.Sprintf("%s --insecure-options=image prepare %s", ctx.Cmd(), imgID.path)

43 podUuid := runRktAndGetUUID(t, cmd)

44

77 podUUID := runRktAndGetUUID(t, cmd)

78 uuidFile, err := ioutil.TempFile(tmpDir, "uuid-file")

79 if err != nil {

81 }

82 uuidFilePath := uuidFile.Name()

83 if err := ioutil.WriteFile(uuidFilePath, []byte(podUUID), 0600); err != nil {

84 panic(fmt.Sprintf("Cannot write pod UUID to uuid-file: %v", err))

85 }

86 runCmd := fmt.Sprintf("%s cat-manifest --uuid-file=%s --pretty-print=false %s", ctx.Cmd(), uuidFilePath)

87 t.Logf("Running test #%d", i)

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

3 import (

4 "regexp"

5 "strings"

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

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

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

31

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

33 sOut = strings.ToUpper(sOut)

downward_api.go (https://gitlab.com/cybok/kubernetes) Go · 105 lines

32 It("should provide pod name and namespace as env vars [Conformance]", func() {

33 podName := "downward-api-" + string(util.NewUUID())

34 env := []api.EnvVar{

63 It("should provide pod IP as an env var", func() {

64 podName := "downward-api-" + string(util.NewUUID())

65 env := []api.EnvVar{

103

104 f.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations)

105 }

vbm.go (https://gitlab.com/Red54/machine) Go · 94 lines

9 "path/filepath"

10 "regexp"

11 "runtime"

17 var (

18 reVMNameUUID = regexp.MustCompile(`"(.+)" {([0-9a-f-]+)}`)

19 reVMInfoLine = regexp.MustCompile(`(?:"(.+)"|(.+))=(?:"(.*)"|(.*))`)

20 reColonLine = regexp.MustCompile(`(.+):\s+(.*)`)

21 reEqualLine = regexp.MustCompile(`(.+)=(.*)`)

22 reEqualQuoteLine = regexp.MustCompile(`"(.+)"="(.*)"`)

23 reMachineNotFound = regexp.MustCompile(`Could not find a registered machine named '(.+)'`)

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

6 "path"

7 "regexp"

8 "testing"

34 output: &Config{},

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

36 },

40 output: &Config{},

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

42 },

53 }

54 if b, _ := regexp.Match(tc.errorMatch, []byte(err.Error())); !b {

55 t.Errorf("unexpected error: %v, expected %v", err, tc.errorMatch)

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

6 "net"

7 "regexp"

8 "testing"

219

220 func TestGenerateUUID(t *testing.T) {

221 prev := generateUUID()

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

223 id := generateUUID()

224 if prev == id {

227

228 matched, err := regexp.MatchString(

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

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

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

17 func (id ID) IsValid() bool {

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

19 }

regexes.go (https://bitbucket.org/afawkes/acs-engine.git) Go · 63 lines

43 hexcolorRegex = regexp.MustCompile(hexcolorRegexString)

44 rgbRegex = regexp.MustCompile(rgbRegexString)

45 rgbaRegex = regexp.MustCompile(rgbaRegexString)

48 emailRegex = regexp.MustCompile(emailRegexString)

49 base64Regex = regexp.MustCompile(base64RegexString)

50 iSBN10Regex = regexp.MustCompile(iSBN10RegexString)

51 iSBN13Regex = regexp.MustCompile(iSBN13RegexString)

52 uUID3Regex = regexp.MustCompile(uUID3RegexString)

53 uUID4Regex = regexp.MustCompile(uUID4RegexString)

54 uUID5Regex = regexp.MustCompile(uUID5RegexString)

55 uUIDRegex = regexp.MustCompile(uUIDRegexString)

56 aSCIIRegex = regexp.MustCompile(aSCIIRegexString)

57 printableASCIIRegex = regexp.MustCompile(printableASCIIRegexString)

58 multibyteRegex = regexp.MustCompile(multibyteRegexString)

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

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 {

15

16 // IsValid returns true if the UUID is compatible with RFC 4122.

17 func (s UUID) IsValid() bool {

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

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

17 func (s ID) IsValid() bool {

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

19 }

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

5 "log"

6 "regexp"

7 "time"

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)$`)

125 return re.MatchString(id)

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

53

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

55 // of the query being executed.

56 Regexp string

57 }

60 type PreparedQueryDefinition struct {

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

62 ID string

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

6 "io"

7 "github.com/google/uuid"

8 "fmt"

12 const (

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

14 )

23

24 func UUID() string {

25 return uuid.New().String()

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

22

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

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

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

55 case "zone":

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

57 case "ipaddress":

81 }

82 err = fmt.Errorf("Could not find UUID of OS Type: %s", value)

83 case "project":

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://gitlab.com/silenteh/gantryos) Go · 57 lines

19 if err == nil {

20 uuidSlice = []string{"uuid", u.GoUuid}

21 } else {

22 uuidSlice = []string{"named-uuid", u.GoUuid}

23 }

30 if err := json.Unmarshal(b, &ovsUuid); err == nil {

31 u.GoUuid = ovsUuid[1]

32 }

43 if !validUUID.MatchString(u.GoUuid) {

44 return errors.New("uuid does not match regexp")

45 }

52 //uuidMap := make(map[string]string)

53 //uuidMap["named-uuid"] = id

54 //return []map[string]string{uuidMap}

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

26 //

27 type UUID [16]byte

28

30

31 // e.g.:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6

32 //

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:])

44

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

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

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

5 "errors"

6 "regexp"

7 "time"

8

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

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

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

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

29 if err != nil {

55 func (u *User) GenerateAPIKey() {

56 token := uuid.New()

57 u.APIKey = base64.StdEncoding.EncodeToString([]byte(token))

graph.go (https://bitbucket.org/afawkes/acs-engine.git) Go · 125 lines

4 "fmt"

5 "regexp"

6 "time"

11 "github.com/Azure/go-autorest/autorest/to"

12 "github.com/satori/go.uuid"

13 log "github.com/sirupsen/logrus"

47

48 servicePrincipalClientSecret = uuid.NewV4().String()

49

58 {

59 KeyID: to.StringPtr(uuid.NewV4().String()),

60 StartDate: &startDate,

90 func (az *AzureClient) CreateRoleAssignmentSimple(resourceGroup, servicePrincipalObjectID string) error {

91 roleAssignmentName := uuid.NewV4().String()

92

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

9 "os"

10 "regexp"

11 "time"

18 ST:blahblahblah

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

20 `

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

4 "fmt"

5 "regexp"

6 "testing"

10

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

25 t.FailNow()

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

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

43 t.FailNow()

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

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

uuid_test.go (https://gitlab.com/sthysel/vault) Go · 22 lines

1 package uuid

2

3 import (

4 "regexp"

5 "testing"

7

8 func TestGenerateUUID(t *testing.T) {

9 prev := GenerateUUID()

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

11 id := GenerateUUID()

12 if prev == id {

15

16 matched, err := regexp.MatchString(

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

uuid_test.go (https://gitlab.com/JWLAB/uuid) Go · 43 lines

1 package uuid

2

4 "fmt"

5 "regexp"

6 "testing"

11 func Test_New(t *testing.T) {

12 Convey("Given new UUID is generated.", t, func() {

13 uuid, _ := New()

14 match, _ := regexp.MatchString("^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", uuid)

15 fmt.Println(uuid)

16 Convey("A valid v4 UUID is generated.", func() {

17 So(match, ShouldBeTrue)

22 func Test_NewUnique(t *testing.T) {

23 Convey("Given 100000 UUIDs are generated.", t, func() {

24 umap := make(map[string]bool)

item.go (https://github.com/facette/facette.git) Go · 58 lines

5

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

7 "github.com/jinzhu/gorm"

24 if i.ID == "" {

25 id, err := uuid.GenerateUUID()

26 if err != nil {

30 scope.SetColumn("ID", id)

31 } else if _, err := uuid.ParseUUID(i.ID); err != nil {

32 return ErrInvalidID

34

35 if !nameRegexp.MatchString(i.Name) {

36 return ErrInvalidName

validator.go (https://gitlab.com/mahina/platform) Go · 12 lines

2

3 import "regexp"

4

5 const uuidExpr string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"

6

7 var rxUUID = regexp.MustCompile(uuidExpr)

8

9 // IsUUID determines the validity of the passed UUID

10 func IsUUID(value string) bool {

11 return rxUUID.MatchString(value)

12 }

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

2

3 import "regexp"

4

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

6

9 ID int64

10 Session UUID

11 Marker string

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

1 package uuid

2

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 }