mirror of
https://github.com/golang/go.git
synced 2024-09-30 14:57:10 +00:00
Merge 1e7b236f3f
into b28b263a91
This commit is contained in:
commit
101802726e
@ -226,6 +226,7 @@ func ExampleRegexp_ReplaceAll() {
|
||||
re := regexp.MustCompile(`a(x*)b`)
|
||||
fmt.Printf("%s\n", re.ReplaceAll([]byte("-ab-axxb-"), []byte("T")))
|
||||
fmt.Printf("%s\n", re.ReplaceAll([]byte("-ab-axxb-"), []byte("$1")))
|
||||
// Tries to find the named group `$1W` which is not present, so empty.
|
||||
fmt.Printf("%s\n", re.ReplaceAll([]byte("-ab-axxb-"), []byte("$1W")))
|
||||
fmt.Printf("%s\n", re.ReplaceAll([]byte("-ab-axxb-"), []byte("${1}W")))
|
||||
|
||||
@ -257,6 +258,7 @@ func ExampleRegexp_ReplaceAllString() {
|
||||
re := regexp.MustCompile(`a(x*)b`)
|
||||
fmt.Println(re.ReplaceAllString("-ab-axxb-", "T"))
|
||||
fmt.Println(re.ReplaceAllString("-ab-axxb-", "$1"))
|
||||
// Tries to find the named group `$1W` which is not present, so empty.
|
||||
fmt.Println(re.ReplaceAllString("-ab-axxb-", "$1W"))
|
||||
fmt.Println(re.ReplaceAllString("-ab-axxb-", "${1}W"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user