mjijackson/citrus — Issue #34: Help creating a rule for a last name
Author: rejeep
Created: 2011-10-26 08:47:30+00:00
State: open

Hi,

I'm trying to create a rule for a last name. This is what I have come up with:

rule last_name
[A-Za-z]+ space [iI]+ | [iI]+ &[^iI]+ | [^iI] [A-Za-z]+
end

So:

* Match a "name", followed by a space, followed by any number of `i's`. Or
* If the first characters are one or more `i's`, then something that is not an `i` must follow. Or
* If the first character is not an `i`, then any "name" can follow

If correct, this should be able to parse:

* Rule 1) Love III
* Rule 2) Immelman
* Rule 3) Donald

But it fails on `Immelman`. It would also fail on for example `Love IIIx`.

I guess my second rule is wrong? But why?