Archos
unread,Dec 31, 2011, 5:49:18 AM12/31/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
I've a string with the verb's format for Printf, and I would want to
convert to %s (because I've each into string)
===
package main
import (
"fmt"
"regexp"
)
var value = "\"(%d, %d) = %d\\n\""
func main() {
// The idea is replace [bcdefgopqstvxEGTUX] by 'v' after of be
matched
reVerb := regexp.MustCompile(`[^\\]%[+\-# 0]?([bcdefgopqstvxEGTUX])`)
r := reVerb.ReplaceAllString(value, "v")
fmt.Println(value)
fmt.Println(r)
}
===
But the result isn't what I was expecting
"v,v) =v\n"