Sha256: 33e92575969907b7ecd49953f190299954feb2872a82d14069fe8bf3da1ca642
Contents?: true
Size: 917 Bytes
Versions: 52
Compression:
Stored size: 917 Bytes
Contents
require File.expand_path('../../../spec_helper', __FILE__) describe "Literal Regexps" do it 'supports (?<= ) (positive lookbehind)' do /foo.(?<=\d)/.match("fooA foo1").to_a.should == ["foo1"] end it 'supports (?<! ) (negative lookbehind)' do /foo.(?<!\d)/.match("foo1 fooA").to_a.should == ["fooA"] end it 'supports \g (named backreference)' do /(?<foo>foo.)bar\g<foo>/.match("foo1barfoo2").to_a.should == ["foo1barfoo2", "foo2"] end it 'supports character class composition' do /[a-z&&[^a-c]]+/.match("abcdef").to_a.should == ["def"] /[a-z&&[^d-i&&[^d-f]]]+/.match("abcdefghi").to_a.should == ["abcdef"] end it 'supports possessive quantifiers' do /fooA++bar/.match("fooAAAbar").to_a.should == ["fooAAAbar"] /fooA++Abar/.match("fooAAAbar").should be_nil /fooA?+Abar/.match("fooAAAbar").should be_nil /fooA*+Abar/.match("fooAAAbar").should be_nil end end
Version data entries
52 entries across 52 versions & 2 rubygems