URL regex does not fully match every URL
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 391
- PR merge metrics
- No merged PRs in 30d
Description
For example:

I would like it to return both google.co and google.com. Sadly, it may be impossible considering the way regular expressions work. Thus, it would be amazing to match the longest string (`pywhat google.com/help` should return `google.com/help`). It is crucial for implementing URL subcategories properly(#51). Btw, URL regex is too long, I do not think that valid TLDs should be checked, so it may be shortened.
Contributor guide
Research direction
Start with pyWhat’s URL regex implementation and inspect issue #51 for the URL subcategory context. Reproduce the examples in the issue, including google.co, google.com, and pywhat google.com/help; done means the matching behavior is covered and the intended longest-match result is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100