Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleRegexp_SubexpIndex (0.16 sec)

  1. src/regexp/example_test.go

    	fmt.Println(reversed)
    	fmt.Println(re.ReplaceAllString("Alan Turing", reversed))
    	// Output:
    	// true
    	// ["" "first" "last"]
    	// ${last} ${first}
    	// Turing Alan
    }
    
    func ExampleRegexp_SubexpIndex() {
    	re := regexp.MustCompile(`(?P<first>[a-zA-Z]+) (?P<last>[a-zA-Z]+)`)
    	fmt.Println(re.MatchString("Alan Turing"))
    	matches := re.FindStringSubmatch("Alan Turing")
    	lastIndex := re.SubexpIndex("last")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 00:22:53 UTC 2023
    - 11.1K bytes
    - Viewed (0)
Back to top