Current Path : /usr/local/lib/ruby/1.8/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/lib/ruby/1.8/eregex.rb |
# this is just a proof of concept toy. class RegOr def initialize(re1, re2) @re1 = re1 @re2 = re2 end def =~ (str) @re1 =~ str or @re2 =~ str end end class RegAnd def initialize(re1, re2) @re1 = re1 @re2 = re2 end def =~ (str) @re1 =~ str and @re2 =~ str end end class Regexp def |(other) RegOr.new(self, other) end def &(other) RegAnd.new(self, other) end end if __FILE__ == $0 p "abc" =~ /b/|/c/ p "abc" =~ /b/&/c/ end