【发布时间】:2012-01-29 21:51:01
【问题描述】:
我想从notes 中删除从example_header 开始的所有内容。我试着做:
example_header = <<-EXAMPLE
-----------------
---| Example |---
-----------------
EXAMPLE
notes = <<-HTML
Hello World
#{example_header}
Example Here
HTML
puts notes.gsub(Regexp.new(example_header + ".*", Regexp::MULTILINE), "")
但输出是:
Hello World
||
为什么|| 没有被删除?
【问题讨论】: