Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
cobalt
on June 23, 2014
|
parent
|
context
|
favorite
| on:
In search of the perfect URL validation regex
What's wrong with /([\w-]+:\/\/[^\s]+)/gi
It's not fancy but it will essentially match any url
zAy0LfpBZLC8mAC
on June 23, 2014
[–]
/./ will also match any URL. The point is to
reject
non-URLs.
mathias
on June 23, 2014
|
parent
[–]
Yes, to reject non-URLs and also some URLs that are technically valid but that I want to explicitly disallow anyway.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
It's not fancy but it will essentially match any url