sqlparse icon indicating copy to clipboard operation
sqlparse copied to clipboard

Wrong Integer, Float tokenize

Open HlibPylypets opened this issue 5 years ago • 0 comments

(r'(?![_A-ZÀ-Ü])-?(\d+(\.\d*)|\.\d+)(?![_A-ZÀ-Ü])', tokens.Number.Float) (r'(?![_A-ZÀ-Ü])-?\d+(?![_A-ZÀ-Ü])', tokens.Number.Integer)

Why do we have here negative lookahead at the beginning? Shouldn't it look behind?! I would suggest replacing (?![_A-ZÀ-Ü]) with (?<![_A-ZÀ-Ü])

There is no point for lookahead here since the expression following (?![_A-ZÀ-Ü]) is definitely not in [_A-ZÀ-Ü]

HlibPylypets avatar Jun 02 '20 14:06 HlibPylypets