Class: Regexp
- Inherits:
-
Object
- Object
- Regexp
- Defined in:
- lib/htree/regexp-util.rb
Instance Method Summary collapse
Instance Method Details
#disable_capture ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/htree/regexp-util.rb', line 2 def disable_capture re = '' self.source.scan(/\\.|[^\\\(]+|\(\?|\(/m) {|s| if s == '(' re << '(?:' else re << s end } if re.respond_to? :force_encoding re.force_encoding(self.encoding) Regexp.new(re, self.) else Regexp.new(re, self., self.kcode) end end |