#229 Documentation: State range [-.] not being legal

Martin Miller
Clem Wang

In many other languages that support regular expressions, this is a legal representation of matching a dot or a dash:


awk also allows:


However, Quex isn't happy with this. I don't know if you want to go with what's popular and also allow these. But if you don't, you might want to document that Quex, you need to escape the dash with a backslash:


Not a big deal as the Quex error message is pretty clear:

simple.qx:15:error: Regular expression parsing:
simple.qx:15:error: Character range operator '-' requires a preceding character as in 'a-z'.

simple.qx:15:error: Regular expression parsing:
simple.qx:15:error: Character range: '-' requires a character following '-'.


  • Clem Wang
    Clem Wang

    [:] also triggers an error, when many other regexp packages don't.

    IMHO, if there's just the one colon at the beginning (or end) of the [] expression, then I think Quex should just treat the colon as just character. However, if there are two colons, then I would make that an error, unless it's a known pattern:


    where patternname is something like whitespace.

    Not a big deal. I can see it being annoying if one is porting over a bunch of regular expressions and they have to be tweaked to account for these minor differences.