marcas91 / xeger

Automatically exported from code.google.com/p/xeger
0 stars 0 forks source link

Empty and Union #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. make a regex containing a union with an empty string e.g. "|a" "a|" or "a||b"
2. create a Xeger object with this regex, 
3. Using the Xeger object, create an instance of this regex.

What is the expected output? What do you see instead?
The expected output is either an empty string, or a valid string from the union.
Xeger will raise a parse error or produce the wrong output: it seems '|' is 
read as a normal character.

What version of the product are you using? On what operating system?
The latest version of Xeger.
On windows 7, service pack 1.

Please provide any additional information below.
See Unit tests attached to this issue for examples and expectations (as set by 
the build-in regex matching functionality of java).

A workaround of this bug is as follows:
replace all occurrences of "|" by "()|()" before passing your regex to Xeger.

Original issue reported on code.google.com by Pierre.v...@gmail.com on 30 Jun 2014 at 6:54

Attachments: