Project

General

Profile

Bug #15583 ยป t.rb

Test script showing confusing behavior of /{n}?/ - davisjam (James Davis), 02/01/2019 03:14 PM

 
1
if /a{1,}?/.match("")
2
	puts "a{1,}? matched the empty string"
3
else
4
	puts "a{1,}? did not match"
5
end
6

    
7
if /a{1,3}?/.match("")
8
	puts "a{1,3}? matched the empty string"
9
else
10
	puts "a{1,3}? did not match"
11
end
12

    
13
if /a{,1}?/.match("")
14
	puts "a{,1}? matched the empty string"
15
else
16
	puts "a{,1}? did not match"
17
end
18

    
19
if /a{1}?/.match("")
20
	puts "a{1}? matched the empty string"
21
else
22
	puts "Did not match"
23
end