Project

General

Profile

Actions

Bug #15938

closed

Error thrown undeterministically: `RegexpError: empty range in char class`

Added by dlee (David Lee) almost 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:93232]

Description

When instantiating a Regexp, we only sometimes see RegexpError: empty range in char class.

To reproduce:
100.times { Regexp.new("^([\\w'+-.%]+@[\\w-.]+\\.[A-Za-z]{2,25})(,[\\w+-.%]+@[\\w-.]+\\.[A-Za-z]{2,4}){0,4}$") }
usually does not throw the error, but
100000.times { Regexp.new("^([\\w'+-.%]+@[\\w-.]+\\.[A-Za-z]{2,25})(,[\\w+-.%]+@[\\w-.]+\\.[A-Za-z]{2,4}){0,4}$") }
usually throws the error.

Furthermore, sometimes accompanying calls matter:
10.times { Regexp.new("[\\w-.]"); Regexp.new("[\\w-]") }
usually does not throw the error, but
10.times { Regexp.new("[\\w-.]") }
usually throws the error.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0