Closed as not planned
Description
Go version
1.22.2
Output of go env
in your module/workspace:
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Administrator\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Administrator\go
set GOPRIVATE=
set GOPROXY=http://172.16.130.132:8081/repository/go-local/
set GOROOT=D:/Program Files/Go1.22.2
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\Work\Git\system-watcher-api\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build2208406462=/tmp/go-build -gno-record-gcc-switches
What did you do?
when i rename uploaded filenames, codes below
package main
import (
"fmt"
"regexp"
)
func main () {
var filename = "abc.123.txt"
var pattern = regexp.MustCompile("^(.+?)\\.([^\\.]+)$")
fmt.Println(pattern.ReplaceAllString(filename, "$1_.$2"))
}
What did you see happen?
output result: .txt
fmt.Println(pattern.ReplaceAllString(filename, "$1000.$2"))
the result unchanged
What did you expect to see?
it seems that golang can't get group no and strings
when i try this replacement in javascript and c#, the out is "abc.123000.txt", which is my expected result
Metadata
Metadata
Assignees
Labels
No labels