【发布时间】:2011-07-08 19:58:00
【问题描述】:
我正在尝试执行这样的代码:
template = "
... here html tags
[sitename]
... here html tags
"
template = template.gsub(/\[sitename\]/,"http://google.com")
但它不起作用。我的错误是什么?
【问题讨论】:
我正在尝试执行这样的代码:
template = "
... here html tags
[sitename]
... here html tags
"
template = template.gsub(/\[sitename\]/,"http://google.com")
但它不起作用。我的错误是什么?
【问题讨论】:
你能描述一下它是如何不工作的吗?
在 ruby 1.9.2 中,我得到了我所期望的命令
puts template
给予
... here html tags
http://google.com
... here html tags
【讨论】: