regex - Lexer Rule To avoid more than one occurrence of a character -
i want write lexer rule antlr4 check few user ids. need check string doesn't contain dot @ beginning, may have dot in middle dot can't occur consecutively. can me idea?
if dot cannot occur @ end either, use (with perhaps different definition of valid
:
valid: [a-za-z0-9] userid: valid ('.'? valid)*
if wanted allow dot @ end, add that:
userid: valid ('.'? valid)* '.'?
Comments
Post a Comment