Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #230 +/- ##
=======================================
Coverage 92.60% 92.60%
=======================================
Files 15 15
Lines 1217 1217
=======================================
Hits 1127 1127
Misses 90 90 Continue to review full report at Codecov.
|
5a24773 to
db8da14
Compare
bee-san
approved these changes
Nov 7, 2021
bee-san
approved these changes
Nov 7, 2021
Collaborator
Author
What change is needed? Regex is no longer hard-coded in there. |
Oh, that is great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
β Pull Requests not made with this template will be automatically closed π₯
Prerequisites
Why do we need this pull request?
This should fix a few issues we were seeing with URLs. I have went through the regex and modified some parts. There may still be some cases but with this changes I saw a lot better results.
Also added more
Examplesandhttps://www.google.comnow matches fully.I have written an explanation for regex from start of the URL till the end to make it easier and quicker to review. Also give feedback, so it can get even better. :)
(?i)(?:(?:https?|ftp):\/\/)?(?:\S+:\S+@)?(?:[a-z0-9-_~]+\.)*[a-z0-9-]{1,62}\.(?:COM|IO|BLOG|ORG|TECH)(?::\d{2,5})?(?:\/[a-z0-9-_~.]+)*(?:[?#]\S*)*\/?http/https/ftpis still optional at the beggining.[a-z0-9-_~]with.in-between. Previously this part was matched as whole which caused something likewwww.....google.comto be valid.[a-z0-9-]and is 1-62 characters long.[a-z0-9-_~.]with/in-between.?or#characters it basically matches to everything after it until there is a space or line break. I do not think this characters can get any more limited.What GitHub issues does this fix?
Copy / paste of output
Please copy and paste the output of PyWhat with your new addition using an example that tests this addition below: