diff --git a/lib/regexp-examples/parser.rb b/lib/regexp-examples/parser.rb index 2c85eb9..96bf19e 100644 --- a/lib/regexp-examples/parser.rb +++ b/lib/regexp-examples/parser.rb @@ -29,7 +29,7 @@ def initialize(regexp_string, regexp_options) end def parse - repeaters = [] + repeaters = [PlaceHolderGroup.new] until end_of_regexp group = parse_group(repeaters) return [group] if group.is_a? OrGroup diff --git a/spec/regexp-examples_spec.rb b/spec/regexp-examples_spec.rb index 019d943..2fb7403 100644 --- a/spec/regexp-examples_spec.rb +++ b/spec/regexp-examples_spec.rb @@ -261,6 +261,10 @@ def self.examples_are_empty(*regexps) ) end + context 'for empty regex' do + it { expect(//.examples).to eq [''] } + end + context 'for comment groups' do examples_exist_and_match( /a(?#comment)b/,