summaryrefslogtreecommitdiff
path: root/lib/eregex.rb
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-01-16 12:19:22 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-01-16 12:19:22 +0000
commitf12baed5df6d3c213dd75d2f0d9f36bb179fb843 (patch)
treec39f9c14cd6f8bcf85b6b842a2774cafb102bc2e /lib/eregex.rb
parent22ab6d39643b1bbc997e15b763d2b12996b1f1b9 (diff)
This commit was manufactured by cvs2svn to create branch 'RUBY'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/RUBY@9 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/eregex.rb')
-rw-r--r--lib/eregex.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/eregex.rb b/lib/eregex.rb
new file mode 100644
index 0000000000..f214f6a2d4
--- /dev/null
+++ b/lib/eregex.rb
@@ -0,0 +1,39 @@
+
+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
+
+p "abc" =~ /b/|/c/
+p "abc" =~ /b/&/c/
+
+
+
+
+