-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize URL regular expression matching rules #391
base: master
Are you sure you want to change the base?
Conversation
Instead of reinventing the wheel, perhaps we could use Django regex?
|
The Django one looks awesome. Could you share which Django source file includes that? |
https://github.com/django/django/blob/stable/1.7.x/django/core/validators.py#L68 This is from an earlier version, they made some refactoring after v1.7.x |
Thanks for the pointer. Indeed the URLValidator class in Django 3.x looks quite complicated. Looking into Django's regex, I noticed that it requires the protocol part, while the current regex allows "URLs" like |
It seems like we can get away by making the protocol part optional. Ideally, this would require an unittest with proper url test cases. Also it does not support foreign addresses, unfortunately..
|
Did you mean URLs with non-ASCII characters? That is an issue as the current version seems to support that.
Good idea! Just that it's better to write tests in Qt. I heard there are subtle differences among regular expression implementations. |
Yes, I don't think those would match |
Solve the problem that URL recognition is not accurate enough.