摘要: 1, Ruby的正则表达式以"//"作为构造方法。表达式返回一个RegExp的对象。 /a/.class #返回类型regexp a= /test/.match("you are the tester") #返回MatchData的对象,即匹配到的字符,如果不匹配返回nil,所以a=test 匹aqv("you are the tester")=~/tester/ #返回匹配的字符串的位置, 如此例的为12 d=/(\w+),(\w+),(\w+)\./.match("123Jack,wang,mrs., to be a b 阅读全文
posted @ 2014-01-10 18:19 纵情向前.... 阅读(183) 评论(11) 推荐(0) 编辑