开发者

Problems with replacing into string

I'm trying to execute code like this:

template = "
... here html tags
[sitename]
... here html tags
"

template = template.gsub(/\[sitename\]/,"http://google.com")

But it's not working. What is my mista开发者_高级运维ke?


Can you describe how it's not working?

In ruby 1.9.2 I get what I expected, the command

puts template

gives

... here html tags
http://google.com
... here html tags
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜