https://github.com/spence/valid_url
Elixir library to validate URLs.
https://github.com/spence/valid_url
elixir url url-validation validation
Last synced: 9 months ago
JSON representation
Elixir library to validate URLs.
- Host: GitHub
- URL: https://github.com/spence/valid_url
- Owner: spence
- License: mit
- Created: 2017-02-12T20:47:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-23T18:29:27.000Z (over 8 years ago)
- Last Synced: 2025-07-31T00:26:03.539Z (11 months ago)
- Topics: elixir, url, url-validation, validation
- Language: Elixir
- Homepage: https://hexdocs.pm/valid_url
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ValidUrl [](https://travis-ci.org/spence/valid_url) [](https://hex.pm/packages/valid_url)
Provides the best known regex for validating and extracting URLs.
It builds on amazing work done by [Diego Perini](https://gist.github.com/dperini/729294)
and [Mathias Bynens](https://mathiasbynens.be/demo/url-regex).
## Installation
The package can be installed as:
1. Add `valid_url` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:valid_url, "~> 0.1.1"}]
end
```
2. Ensure `valid_url` is started before your application:
```elixir
def application do
[applications: [:valid_url]]
end
```
## Usage
```elixir
ValidUrl.validate("https://www.spencercreasey.com") # => true
ValidUrl.validate("ftp://www.example.com") # => true
ValidUrl.validate("www.google.com") # => false
```
## Development
```
mix test
```
## License
MIT
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request