Skip to content

Commit 13ee8f8

Browse files
author
Tom Lord
committed
Multiline examples show the "\n" with top priority
1 parent 0f7474b commit 13ee8f8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ For more detail on this, see [configuration options](#configuration-options).
4646

4747
* Regexp options can also be used:
4848
* Case insensitive examples: `/cool/i.examples #=> ["cool", "cooL", "coOl", "coOL", ...]`
49-
* Multiline examples: `/./m.examples(max_group_results: 999) #=> ["a", "b", "c", ..., "\n"]`
49+
* Multiline examples: `/./m.examples #=> ["\n", "a", "b", "c", "d"]`
5050
* Extended form examples: `/line1 #comment \n line2/x.examples #=> ["line1line2"]`
5151
* Options toggling supported: `/before(?imx-imx)after/`, `/before(?imx-imx:subexpr)after/`
5252

lib/regexp-examples/groups.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def initialize(multiline)
126126

127127
def result
128128
chars = CharSets::Any
129-
chars |= ["\n"] if multiline
129+
chars = (["\n"] | chars) if multiline
130130
chars.map do |result|
131131
GroupResult.new(result)
132132
end

0 commit comments

Comments
 (0)