100+ results for 'regex ansi lang:go'

Not the results you expected?

util.go (https://gitlab.com/vitalii.dr/chezmoi) Go · 190 lines

4 "fmt"

5 "regexp"

6 "strconv"

13 var (

14 goVersionRx = regexp.MustCompile(`\Ago(\d+)(?:\.(\d+)(?:\.(\d+))?)?\z`)

15

16 wellKnownAbbreviations = map[string]struct{}{

17 "ANSI": {},

18 "CPE": {},

170 // validateKeys ensures that all keys in data match re.

171 func validateKeys(data interface{}, re *regexp.Regexp) error {

172 switch data := data.(type) {

testing.go (https://bitbucket.org/pizzafactory/pf-gcc.git) Go · 174 lines

146 if err != nil {

147 println("invalid regexp for -match:", err.String())

148 os.Exit(1)

mysql.go (https://gitlab.com/jamesclonk-io/moviedb-backend) Go · 179 lines

12 "github.com/mattes/migrate/migrate/direction"

13 "regexp"

14 "strconv"

111 if isErr {

112 re, err := regexp.Compile(`at line ([0-9]+)$`)

113 if err != nil {

docker_cli_history_test.go (https://gitlab.com/liwh/docker) Go · 126 lines

4 "fmt"

5 "regexp"

6 "strconv"

94 lines := strings.Split(out, "\n")

95 sizeColumnRegex, _ := regexp.Compile("SIZE +")

96 indices := sizeColumnRegex.FindStringIndex(lines[0])

113 lines := strings.Split(out, "\n")

114 sizeColumnRegex, _ := regexp.Compile("SIZE +")

115 humanSizeRegexRaw := "\\d+.*B" // Matches human sizes like 10 MB, 3.2 KB, etc

116 indices := sizeColumnRegex.FindStringIndex(lines[0])

117 startIndex := indices[0]

123 sizeString := lines[i][startIndex:endIndex]

124 c.Assert(strings.TrimSpace(sizeString), checker.Matches, humanSizeRegexRaw, check.Commentf("The size '%s' was not in human format", sizeString))

125 }

apply.go (https://gitlab.com/admin-github-cloud/hub) Go · 113 lines

5 "io/ioutil"

6 "regexp"

7

68 func transformApplyArgs(args *Args) {

69 gistRegexp := regexp.MustCompile("^https?://gist\\.github\\.com/([\\w.-]+/)?([a-f0-9]+)")

70 pullRegexp := regexp.MustCompile("^(pull|commit)/([0-9a-f]+)")

78 gh := github.NewClient(projectURL.Project.Host)

79 match := pullRegexp.FindStringSubmatch(projectURL.ProjectPath())

80 if match != nil {

87 } else {

88 match := gistRegexp.FindStringSubmatch(arg)

89 if match != nil {

ast.go (https://gitlab.com/CORP-RESELLER/kubernetes) Go · 1743 lines

6 "fmt"

7 "regexp"

8 "sort"

126 func (*ParenExpr) node() {}

127 func (*RegexLiteral) node() {}

128 func (*SortField) node() {}

232 func (*ParenExpr) expr() {}

233 func (*RegexLiteral) expr() {}

234 func (*StringLiteral) expr() {}

756 Name: s.Target.Measurement.Name,

757 Regex: CloneRegexLiteral(s.Target.Measurement.Regex),

758 },

789 if s.Regex != nil {

790 m.Regex = &RegexLiteral{Val: regexp.MustCompile(s.Regex.Val.String())}

791 }

xml.go (https://gitlab.com/CORP-RESELLER/dashboard) Go · 1417 lines

135 Common

136 PostCodeRegex []*struct {

137 Common

138 TerritoryId string `xml:"territoryId,attr"`

139 } `xml:"postCodeRegex"`

140 } `xml:"postalCodeData"`

properties.go (https://gitlab.com/ahastudio/kanban) Go · 746 lines

14 "os"

15 "regexp"

16 "strconv"

45 type Properties struct {

46 // Pre-/Postfix for property expansion.

47 Prefix string

49

50 // DisableExpansion controls the expansion of properties on Get()

51 // and the check for circular references on Set(). When set to

53 // not check for circular references on Get() or on Set().

54 DisableExpansion bool

55

438 // for which the key matches the regular expression.

439 func (p *Properties) FilterRegexp(re *regexp.Regexp) *Properties {

440 pp := NewProperties()

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);

util.go (https://gitlab.com/kumarsiva07/revel) Go · 172 lines

9 "reflect"

10 "regexp"

11 "strings"

66 var (

67 cookieKeyValueParser = regexp.MustCompile("\x00([^:]*):([^\x00]*)\x00")

68 )

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

27 RandomizeAllSpecs bool

28 RegexScansFilePath bool

29 FocusString string

75

76 flagSet.BoolVar(&(GinkgoConfig.RegexScansFilePath), prefix+"regexScansFilePath", false, "If set, ginkgo regex matching also will look at the file path (code location).")

77

150

151 if ginkgo.RegexScansFilePath {

152 result = append(result, fmt.Sprintf("--%sregexScansFilePath", prefix))

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

curly.go (https://gitlab.com/unofficial-mirrors/kubernetes-contrib) Go · 162 lines

8 "net/http"

9 "regexp"

10 "sort"

77 if colon := strings.Index(routeToken, ":"); colon != -1 {

78 // match by regex

79 matchesToken, matchesRemainder := c.regularMatchesPathToken(routeToken, colon, requestToken)

106 }

107 matched, err := regexp.MatchString(regPart, requestToken)

108 return (matched && err == nil), false

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

95 class StringLiteral;

96 class RegExpLiteral;

97 class ArrayLiteral;

ansi.go (https://gitlab.com/djui/pkg) Go · 354 lines

1 package ansi

2

5 "fmt"

6 "regexp"

7 "strconv"

259

260 // RemoveEscapeSequences removes ANSI escape sequences.

261 func RemoveEscapeSequences() {

268

269 // Colors defines the standard HTML colours for ANSI.

270 var Colors = []string{

274

275 // ToHTML converts ANSI escape sequences into HTML span tags.

276 func ToHTML(text []byte) []byte {

277 re := regexp.MustCompile("\u001B\\[([0-9A-Za-z;]+)m([^\u001B]+)")

278 matches := re.FindAllSubmatch(text, -1)

mprof_test.go (https://gitlab.com/adotout/gcc) Go · 179 lines

13 "reflect"

14 "regexp"

15 "runtime"

21

22 func allocateTransient1M() {

23 for i := 0; i < 1024; i++ {

28 //go:noinline

29 func allocateTransient2M() {

30 memSink = make([]byte, 2<<20)

32

33 func allocateTransient2MInline() {

34 memSink = make([]byte, 4<<20)

51

52 // Allocate transient memory using reflect.Call.

53

ingress.go (https://gitlab.com/wilane/traefik) Go · 151 lines

126

127 // HTTPIngressPath associates a path regex with a backend. Incoming urls matching

128 // the path are forwarded to the backend.

129 type HTTPIngressPath struct {

130 // Path is a extended POSIX regex as defined by IEEE Std 1003.1,

131 // (i.e this follows the egrep/unix syntax, not the perl syntax)

sqlmock.go (https://gitlab.com/sheket/server) Go · 454 lines

41 // ExpectQuery expects Query() or QueryRow() to be called with sql query

42 // which match sqlRegexStr given regexp.

43 // the *ExpectedQuery allows to mock database response.

46 // ExpectExec expects Exec() to be called with sql query

47 // which match sqlRegexStr given regexp.

48 // the *ExpectedExec allows to mock database response

257 e := &ExpectedExec{}

258 e.sqlRegex = regexp.MustCompile(sqlRegexStr)

259 c.expected = append(c.expected, e)

300 func (c *sqlmock) ExpectPrepare(sqlRegexStr string) *ExpectedPrepare {

301 e := &ExpectedPrepare{sqlRegex: regexp.MustCompile(sqlRegexStr), mock: c}

302 c.expected = append(c.expected, e)

368 e := &ExpectedQuery{}

369 e.sqlRegex = regexp.MustCompile(sqlRegexStr)

370 c.expected = append(c.expected, e)

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

76 specs := spec.NewSpecs(specsSlice)

77 specs.RegexScansFilePath = config.RegexScansFilePath

78

permalinks.go (https://gitlab.com/Slind/hugo) Go · 189 lines

5 "fmt"

6 "regexp"

7 "strconv"

27

28 var attributeRegexp *regexp.Regexp

29

42

43 matches := attributeRegexp.FindAllStringSubmatch(fragments[i], -1)

44 if matches == nil {

84

85 matches := attributeRegexp.FindAllStringSubmatch(field, -1)

86

187

188 attributeRegexp = regexp.MustCompile(":\\w+")

189 }

headerparser.go (https://gitlab.com/unofficial-mirrors/openshift-source-to-image) Go · 161 lines

4 "fmt"

5 "regexp"

6 "strings"

11 // according to rfc7230

12 reToken = regexp.MustCompile(`^[^"(),/:;<=>?@[\]{}[:space:][:cntrl:]]+`)

13 reQuotedValue = regexp.MustCompile(`^[^\\"]+`)

14 reEscapedCharacter = regexp.MustCompile(`^[[:blank:][:graph:]]`)

15 )

29 func parseForwardedHeader(forwarded string) (map[string]string, string, error) {

30 // Following are states of forwarded header parser. Any state could transition to a failure.

31 const (

32 // terminating state; can transition to Parameter

33 stateElement = iota

nodes.go (https://gitlab.com/rpi-romlinch/drone) Go · 281 lines

2

3 import "regexp"

4 import "strings"

22 "xml": `<?xml version="1.0" encoding="utf-8" ?>`,

23 "transitional": `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">`,

24 "strict": `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">`,

239

240 delExp := regexp.MustCompile(`,\s`)

241 mixin.Args = delExp.Split(args, -1)

264 const t = "%s"

265 quoteExp := regexp.MustCompile(`"(.*?)"`)

266 delExp := regexp.MustCompile(`,\s`)

migrate.go (https://gitlab.com/jamesclonk-io/moviedb-backend) Go · 317 lines

214 }

215 files, err := file.ReadMigrationFiles(migrationsPath, file.FilenameRegex(d.FilenameExtension()))

216 if err != nil {

270 }

271 files, err := file.ReadMigrationFiles(migrationsPath, file.FilenameRegex(d.FilenameExtension()))

272 if err != nil {

versions_test.go (https://gitlab.com/JamesClonk/s3-resource) Go · 156 lines

14 It("returns an empty list of matches", func() {

15 result, err := versions.Match([]string{}, "regex")

16

22 Context("when given a single path", func() {

23 It("returns it in a singleton list if it matches the regex", func() {

24 paths := []string{"abc"}

25 regex := "abc"

26

27 result, err := versions.Match(paths, regex)

28 Ω(err).ShouldNot(HaveOccurred())

31

32 It("returns an empty list if it does not match the regexp", func() {

33 paths := []string{"abc"}

simple.go (https://code.google.com/p/sre2/) Go · 143 lines ✨ Summary

This Go code implements a regular expression (regex) engine, allowing users to match strings against predefined patterns. It uses a finite state machine approach to efficiently search for matches in input strings, capturing groups and returning success indicators. The code is designed to be efficient and scalable, using techniques like sparse bitsets and linked lists to minimize memory usage.

2

3 func (r *sregexp) Match(src string) bool {

4 success, _ := r.run(src, false)

7

8 func (r *sregexp) MatchIndex(src string) []int {

9 _, capture := r.run(src, true)

12

13 func (r *sregexp) run(src string, submatch bool) (success bool, capture []int) {

14 curr := makeStateList(len(r.prog))

21

22 func (r *sregexp) _run(curr *stateList, next *stateList, parser *SafeReader, src string, submatch bool) (success bool, capture []int) {

23 // always start with state zero

51

52 // stateList is used by regexp.run() to efficiently maintain an ordered list of

53 // current/next regexp integer states.

buffer.go (https://gitlab.com/CORP-RESELLER/dashboard) Go · 229 lines

17 "io"

18 "regexp"

19 "sync"

152

153 Finally, you can pass detect a format string followed by variadic arguments. This will construct the regexp using fmt.Sprintf.

154 */

155 func (b *Buffer) Detect(desired string, args ...interface{}) chan bool {

156 formattedRegexp := desired

157 if len(args) > 0 {

159 }

160 re := regexp.MustCompile(formattedRegexp)

161

212

213 func (b *Buffer) didSay(re *regexp.Regexp) (bool, []byte) {

214 b.lock.Lock()

config.go (https://gitlab.com/admin-github-cloud/coreos-baremetal) Go · 154 lines

19 "reflect"

20 "regexp"

21 "strings"

126 vs := fmt.Sprintf("%v", value.Interface())

127 if m, _ := regexp.MatchString(valid, vs); m {

128 return nil

go1pkgrename.go (git://github.com/tav/go.git) Go · 146 lines

19 go1pkgrename,

20 `Rewrite imports for packages moved during transition to Go 1.

21

94 {"old/netchan", ""},

95 {"old/regexp", ""},

96 {"old/template", ""},

service_access_test.go (https://gitlab.com/JamesClonk/cli) Go · 219 lines

214

215 Expect(strings.Join(ui.Outputs, "\n")).To(MatchRegexp(`FAILED\nError finding service brokers`))

216 })

simplify.go (https://gitlab.com/4144/gcc) Go · 151 lines

13 // The returned regexp may share structure with or be the original.

14 func (re *Regexp) Simplify() *Regexp {

15 if re == nil {

19 case OpCapture, OpConcat, OpAlternate:

20 // Simplify children, building new Regexp if children change.

21 nre := re

84 // Build leading prefix: xx.

85 var prefix *Regexp

86 if re.Min > 0 {

87 prefix = &Regexp{Op: OpConcat}

88 prefix.Sub = prefix.Sub0[:0]

133 // generate are simple.

134 func simplify1(op Op, flags Flags, sub, re *Regexp) *Regexp {

135 // Special case: repeat the empty string as much as

signedmanifesthandler.go (https://gitlab.com/github-cloud-corporation/quayctl) Go · 167 lines

122

123 if !reference.NameRegexp.MatchString(mnfst.Name) {

124 errs = append(errs,

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

4 "fmt"

5 "regexp"

6 "strconv"

18 strings.Join([]string{".", ".", ".", ".", "."}, maxPrintableLabel[:49]), ".")

19 reChar = regexp.MustCompile(`.`)

20 i = -1

44 {"unprintable label",

45 string(63) + regexp.MustCompile(`\\[0-9]+`).ReplaceAllStringFunc(maxUnprintableLabel,

46 func(escape string) string {

66 {"too long by pointer",

67 // a matryoshka doll name to get over 255 octets after expansion via internal pointers

68 string([]byte{

78 {"long by pointer",

79 // a matryoshka doll name _not_ exceeding 255 octets after expansion

80 string([]byte{

clusterList.go (https://gitlab.com/oytunistrator/yoke) Go · 78 lines

13 "os"

14 "regexp"

15 "time"

67 //

68 if subMatch := regexp.MustCompile(`^\((.*)\)(.*)$`).FindStringSubmatch(member.State); subMatch != nil {

69 state = subMatch[1]

parse.go (https://gitlab.com/github-cloud-corporation/quayctl) Go · 257 lines

8 "fmt"

9 "regexp"

10 "strings"

173 for name2match := range fieldValues {

174 match, err := regexp.MatchString(name2match, source)

175 if err != nil {

main.go (https://code.google.com/p/godag/) Go · 546 lines ✨ Summary

The code is a command-line tool called godag that compiles and builds Go projects. It takes a source directory as input, parses command-line options, and performs various actions such as formatting code, linking binaries, and running unit tests. The output includes information about the compiled project, such as package info, compile order, and test results.

504 -L --lib write objects to other dir (!src)

505 -M --main regex to select main package

506 -a --all link main pkgs to bin/nameOfMainDir

509 -t --test run all unit-tests

510 -m --match regex to select unit-tests

511 -b --bench regex to select benchmarks

riak.go (https://code.google.com/p/goriak/) Go · 530 lines ✨ Summary

This Go code implements a client for interacting with a Riak NoSQL database using its REST API. It provides methods for making GET, PUT, and other requests to the database, as well as an asynchronous request API that allows for concurrent requests. The code also includes support for callbacks and response channels, enabling developers to handle responses in a flexible manner.

50 "strings"

51 "regexp"

52 //"fmt"

306 if ok {

307 // TODO: regexp would be much cleaner

308 parts := strings.Split(location, "/", -1)

372 if ok {

373 // This should all be REGEXP but just haven't gotten around to

374 // it yet.

375 var LINK_SPLITTER = regexp.MustCompile("^<.*,")

376 linkSplits := LINK_SPLITTER.FindAllString(links, -1)

size.go (https://gitlab.com/ferchoshi1992/gitlab-ci-multi-runner) Go · 95 lines

4 "fmt"

5 "regexp"

6 "strconv"

33 binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB}

34 sizeRegex = regexp.MustCompile(`^(\d+)([kKmMgGtTpP])?[bB]?$`)

35 )

50

51 // HumanSize returns a human-readable approximation of a size

52 // using SI standard (eg. "44kB", "17MB").

53 func HumanSize(size float64) string {

54 return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs)

62

63 // FromHumanSize returns an integer from a human-readable specification of a

64 // size using SI standard (eg. "44kB", "17MB").

task.go (https://gitlab.com/JamesClonk/go-todotxt) Go · 272 lines

8 "fmt"

9 "regexp"

10 "sort"

18

19 priorityRx = regexp.MustCompile(`^(x|x \d{4}-\d{2}-\d{2}|)\s*\(([A-Z])\)\s+`) // Match priority: '(A) ...' or 'x (A) ...' or 'x 2012-12-12 (A) ...'

20 // Match created date: '(A) 2012-12-12 ...' or 'x 2012-12-12 (A) 2012-12-12 ...' or 'x (A) 2012-12-12 ...'or 'x 2012-12-12 2012-12-12 ...' or '2012-12-12 ...'

21 createdDateRx = regexp.MustCompile(`^(\([A-Z]\)|x \d{4}-\d{2}-\d{2} \([A-Z]\)|x \([A-Z]\)|x \d{4}-\d{2}-\d{2}|)\s*(\d{4}-\d{2}-\d{2})\s+`)

22 completedRx = regexp.MustCompile(`^x\s+`) // Match completed: 'x ...'

23 completedDateRx = regexp.MustCompile(`^x\s*(\d{4}-\d{2}-\d{2})\s+`) // Match completed date: 'x 2012-12-12 ...'

24 addonTagRx = regexp.MustCompile(`(^|\s+)([\w-]+):(\S+)`) // Match additional tags date: '... due:2012-12-12 ...'

153 // function for collecting projects/contexts as slices from text

154 getSlice := func(rx *regexp.Regexp) []string {

155 matches := rx.FindAllStringSubmatch(task.Original, -1)

merge.go (https://gitlab.com/jslee1/hub) Go · 88 lines

4 "fmt"

5 "regexp"

6

50

51 pullURLRegex := regexp.MustCompile("^pull/(\\d+)")

52 projectPath := url.ProjectPath()

53 if !pullURLRegex.MatchString(projectPath) {

54 return nil

56

57 id := pullURLRegex.FindStringSubmatch(projectPath)[1]

58 gh := github.NewClient(url.Project.Host)

s3_test.go (https://gitlab.com/vpl/distribution) Go · 238 lines

124 for _, path := range keys {

125 if !storagedriver.PathRegexp.MatchString(path) {

126 t.Fatalf("unexpected string in path: %q != %q", path, storagedriver.PathRegexp)

131 for _, path := range keys {

132 if !storagedriver.PathRegexp.MatchString(path) {

133 t.Fatalf("unexpected string in path: %q != %q", path, storagedriver.PathRegexp)

host.go (https://gitlab.com/Red54/machine) Go · 168 lines

5 "fmt"

6 "regexp"

7 "strings"

22 validHostNameChars = `^[a-zA-Z0-9][a-zA-Z0-9\-\.]*$`

23 validHostNamePattern = regexp.MustCompile(validHostNameChars)

24 errMachineMustBeRunningForUpgrade = errors.New("Error: machine must be running to upgrade.")

imports.go (https://gitlab.com/jasonkumpf/maddy) Go · 173 lines

23 "path/filepath"

24 "regexp"

25 "strings"

27

28 func (ctx *parseContext) expandImports(node Node, expansionDepth int) (Node, error) {

29 // Leave nil value as is because it is used as non-existent block indicator

37 for _, child := range node.Children {

38 child, err := ctx.expandImports(child, expansionDepth+1)

39 if err != nil {

46 // caused this error.

47 if expansionDepth > 255 {

48 return node, NodeErr(child, "hit import expansion limit")

55

56 subtree, err := ctx.resolveImport(child, child.Args[0], expansionDepth)

57 if err != nil {

endpoints.go (https://gitlab.com/jimakker/rancher-letsencrypt) Go · 397 lines

4 "fmt"

5 "regexp"

6

97

98 var schemeRE = regexp.MustCompile("^([^:]+)://")

99

152 // StrictMatching requires the SDK to be updated if you want to take advantage

153 // of new regions and services expansions.

154 //

common.go (https://github.com/dabio/min.git) Go · 230 lines

12

13 // Number returns the number of bytes that parse as a number of the regex format (+|-)?([0-9]+(\.[0-9]+)?|\.[0-9]+)((e|E)(+|-)?[0-9]+)?.

14 func Number(b []byte) int {

path.go (https://gitlab.com/gohugo/hugo) Go · 265 lines

20 "path/filepath"

21 "regexp"

22 "strings"

97 // Should be good enough for Hugo.

98 var isFileRe = regexp.MustCompile(`.*\..{1,6}$`)

99

in_command_test.go (https://gitlab.com/JamesClonk/s3-resource) Go · 317 lines

36 Bucket: "bucket-name",

37 Regexp: "files/a-file-(.*).tgz",

38 },

162

163 Context("when the regexp has no groups", func() {

164 BeforeEach(func() {

165 request.Source.Regexp = "files/a-file-.*.tgz"

166 })

167

168 It("returns an error when the regexp has no groups", func() {

169 _, err := command.Run(destDir, request)

client.go (https://gitlab.com/gohugo/hugo) Go · 90 lines

16 import (

17 "regexp"

18

78 var (

79 regularCSSImportTo = regexp.MustCompile(`.*(@import "(.*\.css)";).*`)

80 regularCSSImportFrom = regexp.MustCompile(`.*(\/\* HUGO_IMPORT_START (.*) HUGO_IMPORT_END \*\/).*`)

sysinfo.go (https://gitlab.com/unofficial-mirrors/openshift-origin) 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 {

mprof_test.go (https://gitlab.com/lobl.pavel/gcc-6.2.0) Go · 99 lines

9 "fmt"

10 "regexp"

11 "runtime"

18

19 func allocateTransient1M() {

20 for i := 0; i < 1024; i++ {

25 //go:noinline

26 func allocateTransient2M() {

27 memSink = make([]byte, 2<<20)

60 // Do the interesting allocations.

61 allocateTransient1M()

62 allocateTransient2M()

81 fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f x]+

82 # 0x[0-9,a-f]+ pprof_test\.allocateTransient1M\+0x[0-9,a-f]+ .*/mprof_test.go:21

83 # 0x[0-9,a-f]+ runtime_pprof_test\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test.go:61

helpers.go (https://gitlab.com/gohugo/hugo) Go · 79 lines

19 "fmt"

20 "regexp"

21

26 const (

27 ansiEsc = "\u001B"

28 clearLine = "\r\033[K"

29 hideCursor = ansiEsc + "[?25l"

30 showCursor = ansiEsc + "[?25h"

70 // The below may be to generic. Time will show.

71 var userErrorRegexp = regexp.MustCompile("unknown flag")

72

77

78 return userErrorRegexp.MatchString(err.Error())

79 }

proof_support_github.go (https://gitlab.com/yenny.prathivi/client) Go · 129 lines

6 import (

7 "regexp"

8 "strings"

72

73 var githubUsernameRegexp = regexp.MustCompile(`^(?i:[a-z0-9][a-z0-9-]{0,38})$`)

74

75 func (t GithubServiceType) NormalizeUsername(s string) (string, error) {

76 if !githubUsernameRegexp.MatchString(s) {

77 return "", BadUsernameError{s}

host.go (https://gitlab.com/vectorci/machine) Go · 223 lines

4 "errors"

5 "regexp"

6

21 var (

22 validHostNamePattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\.]*$`)

23 errMachineMustBeRunningForUpgrade = errors.New("Error: machine must be running to upgrade.")

regex.go (git://github.com/bobappleyard/bwl.git) Go · 285 lines ✨ Summary

This Go code implements a lexer for regular expressions. It creates a lexical analysis system that can parse and match strings against given regex patterns, replacing matched substrings with user-defined functions. The code uses a stack machine approach to handle nested subexpressions and character sets. It returns a BasicState object representing the final state of the parsing process.

24

25 func ExtendSet(base, ext RegexSet) RegexSet {

26 res := make(RegexSet)

42

43 func (self *Lexer) ForceRegex(re string, m RegexSet) *BasicState {

44 res, err := self.Regex(re, m)

51

52 func (self *Lexer) Regexes(m, regexes RegexSet) {

53 for i, x := range regexes {

61

62 func NewRegex(re string, m RegexSet) *Regex {

63 l := New()

122

123 func (self *BasicState) AddRegex(re string, m RegexSet) (*BasicState, error) {

124 if m == nil {

clone.go (https://github.com/ap0ught/hub.git) Go · 156 lines

4 "fmt"

5 "regexp"

6 "strings"

77

78 nameWithOwnerRegexp := regexp.MustCompile(NameWithOwnerRe)

79 for _, i := range p.PositionalIndices {

80 a := args.Params[i]

81 if nameWithOwnerRegexp.MatchString(a) && !isCloneable(a) {

82 url := getCloneURL(a, isSSH, args.Command != "submodule")

main.go (https://gitlab.com/Blueprint-Marketing/syncthing) Go · 143 lines

15 "os"

16 "regexp"

17 "sort"

33 if u, p := userPass(); u == "" || p == "" {

34 log.Fatal("Need environment variables TRANSIFEX_USER and TRANSIFEX_PASS")

35 }

42

43 resp := req("https://www.transifex.com/api/2/project/syncthing/resource/gui/stats")

44

69

70 resp := req("https://www.transifex.com/api/2/project/syncthing/resource/gui/translation/" + code)

71 var t translation

100 func userPass() (string, string) {

101 user := os.Getenv("TRANSIFEX_USER")

102 pass := os.Getenv("TRANSIFEX_PASS")

mysql.go (https://github.com/xo/xo.git) Go · 151 lines

4 "context"

5 "regexp"

6 "strings"

131

132 // setRE is the regexp that matches MySQL SET() type definitions.

133 var setRE = regexp.MustCompile(`(?i)^set\([^)]*\)$`)

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

7 "path"

8 "regexp"

9 "strings"

20 func Matches(str, pattern string) bool {

21 match, _ := regexp.MatchString(pattern, str)

22 return match

33 }

34 r, _ := regexp.Compile(pattern)

35 return string(r.ReplaceAll([]byte(str), []byte("")))

46 }

47 r, _ := regexp.Compile(pattern)

48 return string(r.ReplaceAll([]byte(str), []byte("")))

59 pattern := "[^" + chars + "]+"

60 r, _ := regexp.Compile(pattern)

61 return string(r.ReplaceAll([]byte(str), []byte("")))

init.go (https://gitlab.com/jslee1/hub) Go · 100 lines

4 "path/filepath"

5 "regexp"

6 "strings"

52 dirToInit := "."

53 hasValueRegxp := regexp.MustCompile("^--(template|separate-git-dir|shared)$")

54

size.go (https://gitlab.com/unofficial-mirrors/kubernetes-contrib) Go · 108 lines

4 "fmt"

5 "regexp"

6 "strconv"

33 binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB}

34 sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[bB]?$`)

35 )

56

57 // HumanSizeWithPrecision allows the size to be in any precision,

58 // instead of 4 digit precision used in units.HumanSize.

59 func HumanSizeWithPrecision(size float64, precision int) string {

60 size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs)

63

64 // HumanSize returns a human-readable approximation of a size

65 // capped at 4 valid numbers (eg. "2.746 MB", "796 KB").

address.go (https://gitlab.com/berew/abot) Go · 165 lines

20

21 // regexStreet is useful to search within a regexAddress substring match

22 var regexStreet = regexp.MustCompile(`^\d+\s+[\w#-'\s\.\n]*$`)

23

24 // regexApartment is useful to search within a regexAddress substring match

25 // after the city has been removed.

26 var regexApartment = regexp.MustCompile(`(,\s*)?[#\s\.\w]*[\w\s]+$`)

27

31

32 // regexState is useful to search within a regexAddress substring match after

33 // the zip code has been removed

35

36 // regexZip is useful to search within a regexAddress substring match

37 var regexZip = regexp.MustCompile(`(\d{5}-\d{4}|\d{5})$`)

size.go (https://gitlab.com/unofficial-mirrors/openshift-source-to-image) Go · 108 lines

4 "fmt"

5 "regexp"

6 "strconv"

33 binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB}

34 sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[iI]?[bB]?$`)

35 )

56

57 // HumanSizeWithPrecision allows the size to be in any precision,

58 // instead of 4 digit precision used in units.HumanSize.

59 func HumanSizeWithPrecision(size float64, precision int) string {

60 size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs)

63

64 // HumanSize returns a human-readable approximation of a size

65 // capped at 4 valid numbers (eg. "2.746 MB", "796 KB").

requests.go (https://gitlab.com/shiphitchcock3/kubernetes) Go · 160 lines

74 // of the body of the response.

75 BodyRegex string

76

81 // status code returned in the response.

82 StatusRegex string

83

106 }

107 if opts.BodyRegex == "" {

108 return m{}, errors.New("BodyRegex is a required field")

121 "type": opts.Type,

122 "bodyRegex": opts.BodyRegex,

123 "path": opts.Path,

124 "statusRegex": opts.StatusRegex,

125 }

filesys_windows.go (https://gitlab.com/kiview/gitlab-ci-multi-runner) Go · 82 lines

7 "path/filepath"

8 "regexp"

9 "strings"

14 func MkdirAll(path string, perm os.FileMode) error {

15 if re := regexp.MustCompile(`^\\\\\?\\Volume{[a-z0-9-]+}$`); re.MatchString(path) {

16 return nil

size.go (https://gitlab.com/hasura/kubernetes) Go · 95 lines

4 "fmt"

5 "regexp"

6 "strconv"

33 binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB}

34 sizeRegex = regexp.MustCompile(`^(\d+)([kKmMgGtTpP])?[bB]?$`)

35 )

50

51 // HumanSize returns a human-readable approximation of a size

52 // capped at 4 valid numbers (eg. "2.746 MB", "796 KB").

53 func HumanSize(size float64) string {

54 return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs)

62

63 // FromHumanSize returns an integer from a human-readable specification of a

64 // size using SI standard (eg. "44kB", "17MB").

base.go (https://gitlab.com/CORP-RESELLER/dashboard) Go · 110 lines

18 "encoding/xml"

19 "regexp"

20 "strconv"

98 // Escape characters that can be escaped without further escaping the string.

99 var charRe = regexp.MustCompile(`&#x[0-9a-fA-F]*;|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\[abtnvfr]`)

100

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

36 // clear and encoded in the name of the secret. It must be a random 6 character

37 // string that matches the regexp `^([a-z0-9]{6})$`. Required.

38 BootstrapTokenIDKey = "token-id"

40 // BootstrapTokenSecretKey is the actual secret. It must be a random 16 character

41 // string that matches the regexp `^([a-z0-9]{16})$`. Required.

42 BootstrapTokenSecretKey = "token-secret"

88

89 // BootstrapGroupPattern is the valid regex pattern that all groups

90 // assigned to a bootstrap token by BootstrapTokenExtraGroupsKey must match.

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 {

doc.go (https://gitlab.com/admin-github-cloud/dex) Go · 112 lines

29 You can write your own extension module for sqlite3. For example, below is a

30 extension for Regexp matcher operation.

31

37 SQLITE_EXTENSION_INIT1

38 static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv) {

39 if (argc >= 2) {

61 SQLITE_EXTENSION_INIT2(api);

62 return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8,

63 (void*)db, regexp_func, NULL, NULL);

71 Extensions: []string{

72 "sqlite3_mod_regexp",

73 },

104 ConnectHook: func(conn *sqlite3.SQLiteConn) error {

105 return conn.RegisterFunc("regex", regex, true)

106 },

clone.go (https://gitlab.com/jslee1301/hub) Go · 135 lines

4 "fmt"

5 "regexp"

6 "strings"

50 hasValueRegxp := regexp.MustCompile("^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$")

51 nameWithOwnerRegexp := regexp.MustCompile(NameWithOwnerRe)

52 for i := 0; i < args.ParamsSize(); i++ {

59 } else {

60 if nameWithOwnerRegexp.MatchString(a) && !isCloneable(a) {

61 name, owner := parseCloneNameAndOwner(a)

dispatchers_windows.go (https://gitlab.com/vectorci/docker-1) Go · 65 lines

6 "path/filepath"

7 "regexp"

8 "strings"

57 original = filepath.FromSlash(strings.ToLower(strings.Replace(strings.ToLower(original), strings.ToLower(command)+" ", "", -1)))

58 if len(regexp.MustCompile(`"[a-z]:\\.*`).FindStringSubmatch(original)) > 0 &&

59 !strings.Contains(original, `\\`) &&

svg.go (https://gitlab.com/OBSERVER-DLL/go) Go · 71 lines

9 "bytes"

10 "regexp"

11 "strings"

14 var (

15 viewBox = regexp.MustCompile(`<svg\s*width="[^"]+"\s*height="[^"]+"\s*viewBox="[^"]+"`)

16 graphId = regexp.MustCompile(`<g id="graph\d"`)

17 svgClose = regexp.MustCompile(`</svg>`)

18 )

wrap.go (https://gitlab.com/alidzapp/cloud-torrent) Go · 87 lines

6 "os"

7 "regexp"

8 "text/template"

11 "github.com/andrew-d/go-termutil"

12 "github.com/jpillora/ansi"

13 "github.com/jpillora/sizestr"

23

24 var basicColors = &Colors{string(ansi.ResetBytes), string(ansi.GreenBytes), string(ansi.CyanBytes), string(ansi.YellowBytes), string(ansi.YellowBytes), string(ansi.ResetBytes)}

25 var noColors = &Colors{} //no colors

82

83 var fmtDurationRe = regexp.MustCompile(`\.\d+`)

84

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

util.go (https://gitlab.com/tSURooT/peco) Go · 92 lines

3 import (

4 "regexp"

5 "unicode"

28 // Global var used to strips ansi sequences

29 var reANSIEscapeChars = regexp.MustCompile("\x1B\\[(?:[0-9]{1,2}(?:;[0-9]{1,2})?)*[a-zA-Z]")

30

31 // Function who strips ansi sequences

32 func StripANSISequence(s string) string {

33 return reANSIEscapeChars.ReplaceAllString(s, "")

34 }

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

8 "path/filepath"

9 "regexp"

10 "strings"

14

15 var pattern = regexp.MustCompile(`^[a-zA-Z]:\.$`)

16

106 original = filepath.FromSlash(strings.ToLower(strings.Replace(strings.ToLower(original), strings.ToLower(command)+" ", "", -1)))

107 if len(regexp.MustCompile(`"[a-z]:\\.*`).FindStringSubmatch(original)) > 0 &&

108 !strings.Contains(original, `\\`) &&

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

14 "reflect"

15 "regexp"

16 "sort"

322 expectedOut.WriteString(

323 regexp.QuoteMeta(

324 fmt.Sprintf("diff a/%s/%s b/%s/%s\n", path, fixture.filename, path, fixture.filename),

326 )

327 // Need to use regex to ignore datetimes in diff.

328 expectedOut.WriteString(`--- .+?\n`)

329 expectedOut.WriteString(`\+\+\+ .+?\n`)

330 expectedOut.WriteString(regexp.QuoteMeta(string(fixture.diff)))

331 }

348 }

349 if !regexp.MustCompile(expectedOutString).Match(stdout.Bytes()) {

350 t.Errorf("stdout want match:\n%s\ngot:\n%q", expectedOutString, stdout)

semver.go (https://gitlab.com/chrissexton/nsq) Go · 173 lines

8 "fmt"

9 "regexp"

10 "strconv"

27

28 var versionPat = regexp.MustCompile(charClasses.Replace(pattern))

29

reg.go (git://github.com/moovweb/rubex.git) Go · 135 lines ✨ Summary

The Go code compares the performance of two regular expression libraries, rubex and the native Go library, on a large string. It measures the average time taken by each library to match a pattern against the string in multiple goroutines, demonstrating a significant speed difference between the two libraries. The output shows the average time taken by each library for each run.

The Go code compares the performance of two regular expression libraries, rubex and the native Go library, on a large string. It measures the average time taken by each library to match a pattern against the string in multiple goroutines, demonstrating a significant speed difference between the two libraries. The output shows the average time taken by each library for each run.

1 // Comparing the speeds of the golang native regex library and rubex.

2 // The numbers show a dramatic difference, with rubex being nearly 400

3 // times slower than the native go libraries. Unfortunately for us,

4 // the native go libraries have a different regex behavior than rubex,

5 // so we'll have to hack at it a bit to fit our needs if we decide to use it.

12 import "time"

13 import "regexp"

14 import "runtime"

45 for i := 0; i < NUM; i++ {

46 re1[i] = regexp.MustCompile("[a-c]*$")

47 re2[i] = re.MustCompile("[a-c]*$")

117 } else {

118 render_pages2("regexp", re1, num_routines, num_renders)

119 }

123 } else {

124 render_pages("regexp", re1, num_routines, num_renders)

125 }

mprof_test.go (https://gitlab.com/OBSERVER-DLL/go) Go · 96 lines

9 "fmt"

10 "regexp"

11 "runtime"

18

19 func allocateTransient1M() {

20 for i := 0; i < 1024; i++ {

25 //go:noinline

26 func allocateTransient2M() {

27 memSink = make([]byte, 2<<20)

60 // Do the interesting allocations.

61 allocateTransient1M()

62 allocateTransient2M()

80 fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+

81 # 0x[0-9,a-f]+ runtime/pprof_test\.allocateTransient1M\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:21

82 # 0x[0-9,a-f]+ runtime/pprof_test\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:61

source.go (https://gitlab.com/actions/go-actions) Go · 187 lines

6 import "os"

7 import "regexp"

8 import "strings"

153 // reformat - formats filename from `../../test/me/now/../../` to `test/me/now` and from `.test.me.` to `test.me`

154 var reformat = regexp.MustCompile(`(^([./\\]+)|([./\\]+)$)`)

155

compile.go (https://github.com/inspirer/textmapper.git) Go · 267 lines

13 Name string

14 RE *Regexp

15 Text string // of RE

78 c.out[accept].rule = rule

79 transitiveClosure(c.out[ret:])

80

110

111 func (c *reCompiler) serialize(re *Regexp, resolver Resolver, t trace) {

112 if c.err != nil {

146 if re.min > 16 || re.max > 16 {

147 c.errorf("cannot expand the regexp, too many entities to repeat (max. 16)")

148 return

196 default:

197 log.Fatal("unknown regexp operation")

198 }

router.go (git://github.com/dbrain/soggy.git) Go · 325 lines

48 method string

49 path *regexp.Regexp

50 Routes []*Route

67

68 func (route *Route) CacheCallType(routePath *regexp.Regexp) {

69 handlerType := route.handler.Type()

176

177 func (route *Route) CallHandler(ctx *Context, routePath *regexp.Regexp, relativePath string) {

178 var args []reflect.Value

254

255 func (route *Route) safelyCall(args []reflect.Value, routePath *regexp.Regexp) (result []reflect.Value, err interface{}) {

256 defer func() {

265 rawRegex := "^" + SaneURLPath(path) + "$"

266 routeRegex, err := regexp.Compile(rawRegex)

267 if err != nil {

send.go (https://gitlab.com/gitlab-org/gitaly) Go · 158 lines

7 "io"

8 "regexp"

9 )

31 // value (nil) disables filtering.

32 Filter *regexp.Regexp

33 }

146 func (w *writer) delimiter() byte { return w.options.Delimiter }

147 func (w *writer) filter() *regexp.Regexp { return w.options.Filter }

148

type.go (https://gitlab.com/akomba/ether-bot-wallet) Go · 216 lines

21 "reflect"

22 "regexp"

23 "strconv"

59 // 1. full string 2. type 3. (opt.) is slice 4. (opt.) size

60 freg, err := regexp.Compile("([a-zA-Z0-9]+)(\\[([0-9]*)?\\])?")

61 if err != nil {

70 case res[3] != "":

71 // err is ignored. Already checked for number through the regexp

72 size, _ = strconv.Atoi(res[3])

80

81 treg, err := regexp.Compile("([a-zA-Z]+)([0-9]*)?")

82 if err != nil {

parse.go (https://gitlab.com/GZGavinZhao/cf-tool) Go · 155 lines

9 "path/filepath"

10 "regexp"

11 "strings"

15

16 "github.com/k0kubun/go-ansi"

17

21 func findSample(body []byte) (input [][]byte, output [][]byte, err error) {

22 irg := regexp.MustCompile(`class="input"[\s\S]*?<pre>([\s\S]*?)</pre>`)

23 org := regexp.MustCompile(`class="output"[\s\S]*?<pre>([\s\S]*?)</pre>`)

28 }

29 newline := regexp.MustCompile(`<[\s/br]+?>`)

30 filter := func(src []byte) []byte {

114 contestPath := info.Path()

115 ansi.Printf(color.CyanString("The problem(s) will be saved to %v\n"), color.GreenString(contestPath))

116

util.go (https://gitlab.com/github-cloud-corporation/dbtester) Go · 72 lines

11 "math"

12 "regexp"

13 "strings"

17

18 var ansi = regexp.MustCompile("\033\\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]")

19

20 func DisplayWidth(str string) int {

21 return runewidth.StringWidth(ansi.ReplaceAllLiteralString(str, ""))

22 }

album.go (https://gitlab.com/barsanuphe/radis) Go · 183 lines

8 "path/filepath"

9 "regexp"

10 "sort"

16

17 var albumPattern = regexp.MustCompile(`^([\pL\pP\pS\pN\d\pZ]+) \(([0-9]{4})\) ([\pL\pP\pS\pN\d\pZ]+?)(\[MP3\])?$`)

18

inflections.go (https://gitlab.com/prima101112/test-quiz) Go · 195 lines

96 type inflection struct {

97 regexp *regexp.Regexp

98 replace string

117 infs := []inflection{

118 inflection{regexp: regexp.MustCompile(strings.ToUpper(value[0]) + "$"), replace: strings.ToUpper(value[1])},

119 inflection{regexp: regexp.MustCompile(strings.Title(value[0]) + "$"), replace: strings.Title(value[1])},

120 inflection{regexp: regexp.MustCompile(value[0] + "$"), replace: value[1]},

121 }

128 inflection{regexp: regexp.MustCompile(strings.Title(value[1]) + "$"), replace: strings.Title(value[0])},

129 inflection{regexp: regexp.MustCompile(value[1] + "$"), replace: value[0]},

130 }

138 inflection{regexp: regexp.MustCompile(value[0]), replace: value[1]},

139 inflection{regexp: regexp.MustCompile("(?i)" + value[0]), replace: value[1]},

140 }

apply.go (https://github.com/ap0ught/hub.git) Go · 114 lines

6 "os"

7 "regexp"

8

69 func transformApplyArgs(args *Args) {

70 gistRegexp := regexp.MustCompile("^https?://gist\\.github\\.com/([\\w.-]+/)?([a-f0-9]+)")

71 commitRegexp := regexp.MustCompile("^(commit|pull/[0-9]+/commits)/([0-9a-f]+)")

72 pullRegexp := regexp.MustCompile("^pull/([0-9]+)")

73 for idx, arg := range args.Params {

80 gh := github.NewClient(projectURL.Project.Host)

81 if match := commitRegexp.FindStringSubmatch(projectURL.ProjectPath()); match != nil {

82 patch, apiError = gh.CommitPatch(projectURL.Project, match[2])

83 } else if match := pullRegexp.FindStringSubmatch(projectURL.ProjectPath()); match != nil {

84 patch, apiError = gh.PullRequestPatch(projectURL.Project, match[1])

mprof_test.go (https://gitlab.com/4144/gcc) Go · 117 lines

10 "reflect"

11 "regexp"

12 "runtime"

18

19 func allocateTransient1M() {

20 for i := 0; i < 1024; i++ {

25 //go:noinline

26 func allocateTransient2M() {

27 memSink = make([]byte, 2<<20)

44

45 // Allocate transient memory using reflect.Call.

46

47 func allocateReflectTransient() {

48 memSink = make([]byte, 3<<20)

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

15 "hash"

16 "regexp"

17 )

41

42 var re = regexp.MustCompile(hexPattern)

43

init.go (https://github.com/ap0ught/hub.git) Go · 100 lines

4 "path/filepath"

5 "regexp"

6 "strings"

52 dirToInit := "."

53 hasValueRegexp := regexp.MustCompile("^--(template|separate-git-dir|shared)$")

54

58 arg := args.Params[i]

59 if hasValueRegexp.MatchString(arg) {

60 i++

main.go (https://gitlab.com/admin-github-cloud/discovery.etcd.io) Go · 228 lines

17 // Use the named PostScript font (default Times-Roman)

18 // -m regexp

19 // Only use input records matching regexp.

27 // Use lines of text vsize points apart (default 1.2 * text size)

28 // -x regexp

29 // Exclude input records matching regexp.

49 "os"

50 "regexp"

51 "strings"

63 Use the named PostScript font (default Times-Roman)

64 -m regexp

65 Only use input records matching regexp.

90

91 matchRE *regexp.Regexp

92 excludeRE *regexp.Regexp

checkout.go (https://gitlab.com/jslee1/hub) Go · 127 lines

4 "fmt"

5 "regexp"

6

57

58 pullURLRegex := regexp.MustCompile("^pull/(\\d+)")

59 projectPath := url.ProjectPath()

60 if !pullURLRegex.MatchString(projectPath) {

61 // not a valid PR URL

69

70 id := pullURLRegex.FindStringSubmatch(projectPath)[1]

71 gh := github.NewClient(url.Project.Host)

oci_util.go (https://gitlab.com/unofficial-mirrors/openshift-source-to-image) Go · 126 lines

5 "path/filepath"

6 "regexp"

7 "runtime"

17

18 var refRegexp = regexp.MustCompile(`^` + component + `(?:/` + component + `)*$`)

19 var windowsRefRegexp = regexp.MustCompile(`^([a-zA-Z]:\\.+?):(.*)$`)

28 var err error

29 if !refRegexp.MatchString(image) {

30 err = errors.Errorf("Invalid image %s", image)

44 func splitPathAndImageWindows(reference string) (string, string) {

45 groups := windowsRefRegexp.FindStringSubmatch(reference)

46 // nil group means no match

105 func validateScopeWindows(scope string) error {

106 matched, _ := regexp.Match(`^[a-zA-Z]:\\`, []byte(scope))

107 if !matched {

i18n.go (https://gitlab.com/kumarsiva07/revel) Go · 188 lines

7 "path/filepath"

8 "regexp"

9 "strings"

104

105 if matched, _ := regexp.MatchString(messageFilePattern, info.Name()); matched {

106 if config, error := parseMessagesFile(path); error != nil {

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);

RETokenEndSub.java (https://bitbucket.org/__wp__/mb-linux-msli.git) Java · 70 lines

1 /* gnu/regexp/RETokenEndSub.java

2 Copyright (C) 2006 Free Software Foundation, Inc.

37

38 package gnu.java.util.regex;

39

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

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: