原文链接:http://www.ruby-doc.org/core-1.9.3/Regexp.html Regexp A Regexp holds a regular expression, used to match a pattern against strings. Regexps are created using the /.../ and %r{...} literals, and by the Regexp::new constructor. Regular expressions…
# [Ruby 块]=begin1 块由大量代码构成2 块中代码包含在{}内3 从与其相同名称的函数调用4 可以使用yield语句调用块=enddef test p '在test方法内' yield p '又回到了test方法内' yieldend test {p '你在块内'}#也可以传递由参数的yielddef test yield 5 p '在方法内' yield 100endtest {|i| p "你在块#{i}内"} # 传递多个参数def test yield 5,100…