我有以下字符串:new k8s.KubeRoleBinding(this, "argocd-application-controller", { kind: "RoleBinding", metadata: { labels: { "app.kubernetes.io/component": "application-controller", "app.kubernetes.io/name": "argocd-application-controller", "app.kubernetes.io/part-of": "argocd", }, name: "argocd-application-controller", }, roleRef: { apiGroup: "rbac.authorization.k8s.io", kind: "Role", name: "argocd-application-controller", }, subjects: [{ kind: "ServiceAccount", name: "argocd-application-controller", }],});ID 喜欢删除第一次出现kind:到目前为止,我尝试了以下内容,但它删除了所有出现的情况。 re := regexp.MustCompile("(?m)[\r\n]+^.*kind.*$") res := re.ReplaceAllString(str, "$1")带代码的游乐场链接 : https://play.golang.org/p/SMiyTJvKNVF通缉字符串 :new k8s.KubeRoleBinding(this, "argocd-application-controller", { metadata: { labels: { "app.kubernetes.io/component": "application-controller", "app.kubernetes.io/name": "argocd-application-controller", "app.kubernetes.io/part-of": "argocd", }, name: "argocd-application-controller", }, roleRef: { apiGroup: "rbac.authorization.k8s.io", kind: "Role", name: "argocd-application-controller", }, subjects: [{ kind: "ServiceAccount", name: "argocd-application-controller", }],});
- 1 回答
- 0 关注
- 104 浏览
添加回答
举报
0/150
提交
取消