wolfendale/scalacheck-gen-regexp

Issue with character classes

Closed this issue · 1 comments

There are a couple of issues with character classes:

In Java regexp including a - as a literal character inside a character class is valid as long as it's at the beginning or end of the class:

both [-+] and [+-] would match "-" or "+"

However, as soon as there are characters to either side it attempts to create a range, to get around this you can escape the - like so: [a\\-z] would match "a", "-" or "z".

Currently escaping - is unsupported.

Also, it seems that escaping characters which do not require escaping inside a character class is also valid. Currently that breaks parsing.

Fixed