Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 22 for FindSubmatch (0.17 sec)

  1. src/go/internal/gccgoimporter/importer_test.go

    	}
    
    	verout, err := testenv.Command(t, gpath, "--version").CombinedOutput()
    	if err != nil {
    		t.Logf("%s", verout)
    		t.Fatal(err)
    	}
    	vers := regexp.MustCompile(`(\d+)\.(\d+)`).FindSubmatch(verout)
    	if len(vers) == 0 {
    		t.Fatalf("could not find version number in %s", verout)
    	}
    	major, err := strconv.Atoi(string(vers[1]))
    	if err != nil {
    		t.Fatal(err)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 15 20:17:57 UTC 2022
    - 7.2K bytes
    - Viewed (0)
  2. src/regexp/example_test.go

    	fmt.Printf("%q\n", re.FindAllSubmatch([]byte(`seafood fool`), -1))
    
    	// Output:
    	// [["food" "d"] ["fool" "l"]]
    }
    
    func ExampleRegexp_FindSubmatch() {
    	re := regexp.MustCompile(`foo(.?)`)
    	fmt.Printf("%q\n", re.FindSubmatch([]byte(`seafood fool`)))
    
    	// Output:
    	// ["food" "d"]
    }
    
    func ExampleRegexp_Match() {
    	re := regexp.MustCompile(`foo.?`)
    	fmt.Println(re.Match([]byte(`seafood fool`)))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 00:22:53 UTC 2023
    - 11.1K bytes
    - Viewed (0)
  3. src/runtime/debug_test.go

    	status, err := os.ReadFile(fmt.Sprintf("/proc/%d/status", pid))
    	if err != nil {
    		t.Logf("couldn't get proc tracer: %s", err)
    		return
    	}
    	re := regexp.MustCompile(`TracerPid:\s+([0-9]+)`)
    	sub := re.FindSubmatch(status)
    	if sub == nil {
    		t.Logf("couldn't find proc tracer PID")
    		return
    	}
    	if string(sub[1]) == "0" {
    		return
    	}
    	t.Skip("test will deadlock under a debugger")
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 15:08:04 UTC 2023
    - 8K bytes
    - Viewed (0)
  4. src/regexp/regexp.go

    	if a == nil {
    		return nil
    	}
    	return a[0:2]
    }
    
    // FindSubmatch returns a slice of slices holding the text of the leftmost
    // match of the regular expression in b and the matches, if any, of its
    // subexpressions, as defined by the 'Submatch' descriptions in the package
    // comment.
    // A return value of nil indicates no match.
    func (re *Regexp) FindSubmatch(b []byte) [][]byte {
    	var dstCap [4]int
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:50:01 UTC 2024
    - 38.5K bytes
    - Viewed (0)
  5. src/regexp/find_test.go

    			t.Errorf("match %d: expected %q got %q: %s", n, expect, got, test)
    			return
    		}
    	}
    }
    
    func TestFindSubmatch(t *testing.T) {
    	for _, test := range findTests {
    		result := MustCompile(test.pat).FindSubmatch([]byte(test.text))
    		switch {
    		case test.matches == nil && result == nil:
    			// ok
    		case test.matches == nil && result != nil:
    			t.Errorf("expected no match; got one: %s", test)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 11 15:28:50 UTC 2021
    - 16.3K bytes
    - Viewed (0)
  6. misc/go_android_exec/main.go

    }
    
    func (f *exitCodeFilter) Finish() (int, error) {
    	// f.buf could be empty, contain a partial match of exitRe, or
    	// contain a full match.
    	b := f.buf.Bytes()
    	defer f.buf.Reset()
    	match := f.exitRe.FindSubmatch(b)
    	if len(match) < 2 || match[1] == nil {
    		// Not a full match. Flush.
    		if _, err := f.w.Write(b); err != nil {
    			return 0, err
    		}
    		return 0, fmt.Errorf("no exit code (in %q)", string(b))
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 21 17:46:57 UTC 2023
    - 15.3K bytes
    - Viewed (0)
  7. src/runtime/runtime-gdb_test.go

    	out, err := exec.Command("gdb", "--version").CombinedOutput()
    	if err != nil {
    		t.Skipf("skipping: error executing gdb: %v", err)
    	}
    	re := regexp.MustCompile(`([0-9]+)\.([0-9]+)`)
    	matches := re.FindSubmatch(out)
    	if len(matches) < 3 {
    		t.Skipf("skipping: can't determine gdb version from\n%s\n", out)
    	}
    	major, err1 := strconv.Atoi(string(matches[1]))
    	minor, err2 := strconv.Atoi(string(matches[2]))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 21 22:16:54 UTC 2024
    - 23.2K bytes
    - Viewed (0)
  8. src/cmd/go/internal/modload/init.go

    )
    
    func findImportComment(file string) string {
    	data, err := os.ReadFile(file)
    	if err != nil {
    		return ""
    	}
    	m := importCommentRE.FindSubmatch(data)
    	if m == nil {
    		return ""
    	}
    	path, err := strconv.Unquote(string(m[1]))
    	if err != nil {
    		return ""
    	}
    	return path
    }
    
    // WriteOpts control the behavior of WriteGoMod.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 18:36:30 UTC 2024
    - 69.8K bytes
    - Viewed (0)
  9. src/cmd/go/internal/test/test.go

    	// The string looks like
    	//	test coverage for encoding/binary: 79.9% of statements
    	// Extract the piece from the percentage to the end of the line.
    	re := regexp.MustCompile(`coverage: (.*)\n`)
    	matches := re.FindSubmatch(out)
    	if matches == nil {
    		// Probably running "go test -cover" not "go test -cover fmt".
    		// The coverage output will appear in the output directly.
    		return ""
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 14:34:32 UTC 2024
    - 71.9K bytes
    - Viewed (0)
  10. src/cmd/go/internal/work/exec.go

    	sh := b.BackgroundShell()
    	out, err := sh.runOut(".", nil, "swig", "-version")
    	if err != nil {
    		return err
    	}
    	re := regexp.MustCompile(`[vV]ersion +(\d+)([.]\d+)?([.]\d+)?`)
    	matches := re.FindSubmatch(out)
    	if matches == nil {
    		// Can't find version number; hope for the best.
    		return nil
    	}
    
    	major, err := strconv.Atoi(string(matches[1]))
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 14:46:37 UTC 2024
    - 105.6K bytes
    - Viewed (0)
Back to top